ASCII @

ASCII @ is a programming language created by User:A, due to failing code-golf competitions because @ instructions sometimes take 2 characters. This transpiles to @.
== 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:
 h
Cat:
 :oc
Truth machine:
 ?n:O10
==Quick Reference==
` (vector x)
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 ()
Returns the number 0
1 ()
Returns the number 1
2 ()
Returns the number 2
3 ()
Returns the number 3
4 ()
Returns the number 4
5 ()
Returns the number 5
6 ()
Returns the number 6
7 ()
Returns the number 7
8 ()
Returns the number 8
9 ()
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
C ()
Reads a character from STDIN and returns it as a string
c ()
Reads a character from STDIN and returns its codepoint
h ()
Returns "Hello, World!"
n ()
Reads a number from STDIN and returns it
O (number x)
Outputs x as a fraction and then returns x
O (vector x)
Calls itself on each item of x but puts a space between outputs then returns x
o (number x)
Outputs the character with codepoint floor(x)
o (vector x)
Calls itself on each item of x, then returns x
D (number x)
Outputs the decimal representation of x then returns x
D (vector x)
Calls itself on each item of x but puts a space between outputs then returns x
S ()
Reads STDIN until EOF and returns it as a string
s ()
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
Category:UnimplementedCategory:2019Category:LanguagesCategory:Golfing language