// `newAdder` returns a closure that makes use of the free variables `a` and `b`:
let newAdder = fn(a, b) {
fn(c) { a + b + c };
};
// This constructs a new `adder` function:
let adder = newAdder(1, 2);
adder(8); // => 11// HashMaps + Builtin Functions
let h = {"name": "Alice", "age": 30};
keys(h); // => ["name", "age"]
values(h); // => ["Alice", 30]// Array + Builtin Functions
let arr = [1, 2, 3, 4, 5];
first(arr); // => 1
last(arr); // => 5
rest(arr); // => [2, 3, 4, 5]
push(arr, 6); // => [1, 2, 3, 4, 5, 6]sqrt(16); // => 4.0
pow(2, 3); // => 8.0
sin(0); // => 0.0
cos(0); // => 1.0
log(1); // => 0.0
exp(1); // => 2.718281828459045match("\\d+", "abc123def"); // => true
find("\\d+", "abc123def"); // => "123"
findAll("\\d+", "a1b2c3"); // => ["1", "2", "3"]
replace("\\d+", "abc123def", "XXX"); // => "abcXXXdef"let arr = [3, 1, 4, 1, 5];
sort(arr); // => [1, 1, 3, 4, 5]
unique(arr); // => [3, 1, 4, 5]
slice(arr, 1, 3); // => [1, 4]
indexOf(arr, 4); // => 2
sum(arr); // => 14
min(arr); // => 1
max(arr); // => 5rand(); // => 0.6046602879796196 (random float 0-1)
randInt(10); // => 7 (random int 0-9)hash("hello"); // => 2059638877649177446 (64-bit FNV hash)str(42); // => "42"
int("123"); // => 123
type(42); // => "INTEGER"
abs(-5); // => 5
range(5); // => [0, 1, 2, 3, 4]