@

From Esolang
Jump to navigation Jump to search
Not to be confused with AT.

@ is a golfing language created and maintained by User:Gemdude46. It is still in its very early stages. An interpreter, vague documentation and some examples are available at its GitHub repo.

Structure of a program

The language is made of a tree of function calls. Each character (with some exceptions) represents a function that may take as many or few arguments as it likes. Arguments are then read from directly after it in the code.

For example:

If instruction A takes 1 argument, B takes 2, C takes 3, and D and E both take none, then the @ code

   BADCDBEDE

Would be written in many languages like

   B(A(D()), C(D(), B(E(), D()), E())))

Instruction arguments are evaluated LTR unless the docs explicitly say otherwise. Arguments may not be evaluated at all or may be evaluated more than once.

Values and data types

@ has the following data types:

number - This is an arbitrary precision rational number.

vector - This is an immutable list of other values of any type.

If anything refers to a string, then it means a vector of codepoints.

Anything enclosed in braces is seen as a string literal. String literals are automatically ended on EOF. Should an EOF be encountered where an instruction should be, Š is used.

Examples

Hello world:

   ħ

Cat:

   ¤ōč

Truth machine:

   ?ň¤Ō10

Computational class

@ can invoke the system shell, and therefore is Turing-complete if the shell is. Without this, I do not believe that it is Turing-complete yet as I have not yet implemented variables. They should be in the next release, however.

Quick Reference

Conventions:

  • * means any type is applicable.
  • None means the function doesn't take any arguments.
  • bool is anything in @ "boolified": 0 is falsy, any nonzero value is truthy. An empty vector/string is falsy, any other type is truthy.
Char Arguments Description
#� vector x # is immediately followed by an @ function . If � takes 1 argument, it is mapped over x, if it takes 2, it is left-folded over x. If it takes 2 and x is empty, it returns NULL
$ string x Runs x as a shell command and returns the status code
* number x, number y Returns the product of x and y
vector x, number y Returns x repeated y times
number x, vector y Returns y with all its items multiplied by x
+ (number x, number y) Returns the sum of x and y
(vector x, vector y) Cycles the shorter of x and y until it is the same length as the longer one, then returns a new vector where each item is the sum of the same item of x and y
, (* x, * y) Evaluates x then returns y
- (number x, number y) Returns x - y
/ (number x, number y) Returns x over y
0 None Returns the number 0
1 None Returns the number 1
2 None Returns the number 2
3 None Returns the number 3
4 None Returns the number 4
5 None Returns the number 5
6 None Returns the number 6
7 None Returns the number 7
8 None Returns the number 8
9 None Returns the number 9
? (bool x, * y, * z) If x, evaluate and return y else evaluate and return z
@ (string x) Evaluates x as @ code and returns the output
\ (*x) Outputs a newline ( \n on POSIX, \r\n on NT ) then returns x
^ (number x) Returns x + 1
_ (number x) Returns x - 1
| (number x) Returns |x|
(vector x) Returns the square root of the sum of the squares of the items of x
¤ (* x) Repeatedly evaluates x. Forever.
§ (bool x) Repeatedly evaluate x until it is true then return the last value
¨ (number x, number y) Returns the range [x, y)
(bool x) Repeatedly evaluate x until it is false then return the last value
Č None Reads a character from STDIN and returns it as a string
č None Reads a character from STDIN and returns its codepoint
ħ None Returns "Hello, World!"
ň None Reads a number from STDIN and returns it
Ō (number x) Outputs x as a fraction and then returns x
(vector x) Calls itself on each item of x but puts a space between outputs then returns x
ō (number x) Outputs the character with codepoint floor(x)
(vector x) Calls itself on each item of x, then returns x
Ő (number x) Outputs the decimal representation of x then returns x
(vector x) Calls itself on each item of x but puts a space between outputs then returns x
Š None Reads STDIN until EOF and returns it as a string
š None Reads STDIN until a newline and returns it as a string
Σ (number x) Returns the digital sum of x
(vector x) Returns the sum of the items of x

External resources