Lists
concat - takes a list of strings or a list of lists and concatenates them into a single string or list.
concat(list);
items = ["Hello", "World"]
concat(list); => "HelloWorld"
head - takes a list and returns the first element.
head([0, 1, 2]); => 0
tail - takes a list and returns a list containing all elements except the first.
tail(list);
tail([0, 1, 2]); => [1, 2]
len - takes a list and returns the number of elements.
len(list);
len([0, 1, 2]); => 3
any - takes a list of values, returns true if at least one value is a true boolean value.
any(list);
any([True, False]); => True
any([False, 1]) => False
any([]) => False
all - takes a list of values, returns true if all values are true boolean values.
all(list);
all([True, True]); => True
all([True, 1]) => False
all([]) => True
append - takes a list and a value, returns a list with the value appended.
append(list, value);
append([0, 1, 2], 3); => [0, 1, 2, 3]
prepend - takes a list and a value, returns a list with the value prepended.
prepend(list, value);
prepend([0, 1, 2], -1); => [-1, 0, 1, 2]
map - takes a list and a function, returns a list with the function applied to each element.
map(list, function);
function double(x) { return x * 2; }
map([0, 1, 2, 3, 4], double); => [0, 2, 4, 6, 8]
range - takes a integer, returns a list of integers from 0 to the integer.
range(integer);
range(5); => [0, 1, 2, 3, 4]
nils - takes an integer, returns a list of nils of the given length.
nils(integer);
nils(3); => [nils, nils, nils]
Strings
reverse - takes a string and returns a string with the characters in reverse order.
reverse(string);
reverse("Hello"); => "olleH"
split - takes a string and a separator, returns a list of strings.
split(string, separator);
split("Hello world", ' '); => ["Hello", "world"]
split("Hello world", "ll"); => ["He", "o world"]
join - takes a list of strings and a separator, returns a string.
join(separator, list);
join(" ", ["Hello", "world"]); => "Hello world"