-
Notifications
You must be signed in to change notification settings - Fork 0
Functions
In Arcyóu, nearly everything is a function. Where most languages would have operators for something like 2+2
, Arcyóu has the +
function, like so: (+ 2 2)
. What follows is moderately detailed documentation for every built-in function in Arcyóu.
These are not functions but rather Boolean values, corresponding to true and false respectively. n
was chosen instead of, say f
because of LISP's nil
, which acts in the same way.
Add all arguments, or sum a single list.
E.g.:
(+ 1 2 3 4 5) -> 15
(+ (' 1 2.7 3.2 4) -> 10.9
Subtract two numbers.
E.g.:
(- 7 5) -> 2
(- 8 99.6) -> -91.6
Multiply two objects. If one argument is a list or string and the other is a number, *
applies sequence multiplication.
E.g.:
(* 3 7) -> 21
(* "foo" 2) -> "foofoo"
(* 4 (' 1 3)) -> [1, 3, 1, 3, 1, 3, 1, 3]
Return the first argument divided by the second argument.
Return the first argument divided by the second argument, truncated to an integer.
E.g.:
(#/ 3 2)
would return 1
.
If both arguments are numeric: applies a modulo operation.
If the first argument is a string: applies string formatting.
Returns t
if its first argument is divisible by its second argument, otherwise f
. Equivalent to the anonymous function (F(x y)(? (% x y) f t))
.
Print all arguments, separated by spaces with a trailing newline.
E.g.:
(p "foobar" 34)
will print:
foobar 34
with a newline character on the end.
Return its only argument plus one.
Return its only argument minus one.
If the argument is a list or string: returns the length of the list.
If the arguments are integers: returns the result of a Python-style range() function.
E.g.:
(_ 1 10)
becomes:
[1, 2, 3, 4, 5, 6, 7, 8, 9]
If the argument is a list: return t
if every item in the list has a Boolean value of t
, otherwise n
.
If the arguments are not lists: return t
if every argument has a Boolean value of t
, otherwise n
.
If the argument is a list: return t
if any item in the list has a Boolean value of t
, otherwise n
.
If the arguments are not lists: return t
if any argument has a Boolean value of t
, otherwise n
.
Returns the Boolean inverse of the argument.
Read one line from STDIN.
Read everything from STDIN.
Return the argument converted to an integer number. If it cannot be converted, a value
error will be raised.
Return the argument converted to a floating-point number. If it cannot be converted, a value
error will be raised.
Return if the two arguments are equal.
Return t
if the two arguments are equal and if they are of the same type.
Return t
if the first argument is less than the second argument.
Return t
if the first argument is greater than the second argument.
This is a function which acts exactly like Lisp's progn
: it returns the last of its arguments. This may not seem useful at first, but take a look at this snippet:
(f x (_ 1 10)
(pn
(p "Number:" x)
(* x 3)))
This expression returns a list of the first 9 multiples of three, but also prints them as they are computed. The magic of pn
is that it allows you to place multiple statements inside the body of something like a ?
or a @
.
Similar to pn
, but takes an integer argument first specifying which of its arguments to return.
E.g.:
(pg 1 (+ 3 4) (* 3 4) (/ 3 4))
would return 12
. Note the 0-indexing!
Returns the first argument raised to the power of the second argument.
(n? thing)
is equivalent to (| (#? thing) (.? thing))
.
Direct wrapper around Python's time.sleep
.
Direct wrapper around Python's time.strftime
.
(E thing list)
is equivalent to thing in list
in Python. The name was inspired by the mathematical notation for set membership, ∈
(U+2208).
Takes one optional argument, the delimiter on which to split. By default, it is a space.