Skip to content
bkul edited this page Jan 29, 2018 · 6 revisions

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.

t and n

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.

+ (addition)

Add all arguments, or sum a single list.

E.g.:

(+ 1 2 3 4 5) -> 15
(+ (' 1 2.7 3.2 4) -> 10.9

- (subtraction)

Subtract two numbers.

E.g.:

(- 7 5) -> 2
(- 8 99.6) -> -91.6

* (multiplication)

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]

/ (division)

Return the first argument divided by the second argument.

#/ (floor division)

Return the first argument divided by the second argument, truncated to an integer.

E.g.:

(#/ 3 2)

would return 1.

% (modulo / string format)

If both arguments are numeric: applies a modulo operation.

If the first argument is a string: applies string formatting.

d? (divisibility)

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)).

p (print)

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.

] (increment)

Return its only argument plus one.

[ (decrement)

Return its only argument minus one.

_ (range / length)

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]

& (all / logical AND)

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.

| (any / logical OR)

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.

! (logical NOT)

Returns the Boolean inverse of the argument.

l (read line)

Read one line from STDIN.

q (read all)

Read everything from STDIN.

# (cast to int)

Return the argument converted to an integer number. If it cannot be converted, a value error will be raised.

. (cast to float)

Return the argument converted to a floating-point number. If it cannot be converted, a value error will be raised.

= (equality)

Return if the two arguments are equal.

== (strict equality)

Return t if the two arguments are equal and if they are of the same type.

< (less than)

Return t if the first argument is less than the second argument.

> (greater than)

Return t if the first argument is greater than the second argument.

pn (progn)

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 @.

pg (prog N)

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!

^ (exponentiation)

Returns the first argument raised to the power of the second argument.

b> (bit shift right)

b< (bit shift left)

1> (bit shift 1 to right)

1< (bit shift 1 to left)

b& (bitwise AND)

b| (bitwise OR)

b^ (bitwise XOR)

~ (bitwise NOT)

l? (list type check)

s? (string type check)

#? (int type check)

.? (float type check)

n? (numeric type check)

(n? thing) is equivalent to (| (#? thing) (.? thing)).

zz (sleep for seconds)

Direct wrapper around Python's time.sleep.

st (string format time)

Direct wrapper around Python's time.strftime.

z (zip)

tx (transpose)

lc (lowercase)

uc (uppercase)

E (containment)

(E thing list) is equivalent to thing in list in Python. The name was inspired by the mathematical notation for set membership, (U+2208).

v (string split)

Takes one optional argument, the delimiter on which to split. By default, it is a space.