Builtins

Built-in named operations, beyond the symbolic operators.

Collection

namestack effectdescription
lencoll → intlength of list / string / binary
nthcoll i → elemzero-indexed access
tllist → listtail (drop first)
revlist → list / str → strreverse
srtlist → listsort
takecoll n → collfirst n elements
skipcoll n → colldrop first n elements
ziplhs rhs → listpair-wise zip into list of pairs
rangelo hi → listinteger range [lo .. hi-1]
cutstr delim → listsplit string by delimiter
catlist delim → strjoin list with delimiter
flatlist → listflatten one level (prelude)

Higher-order (named aliases)

namesymboldescription
eachiterate over a list or count
map&!apply block to each element
fil&?filter
red&/fold/reduce
loop&while loop
if?conditional
ifel??ternary

Reflection

namestack effectdescription
typeofa → strtype name string
words→ listall currently-defined names
depth→ intcurrent stack height
cleardrop all stack values

Type constructors

Every type name is a constructor. They convert the top-of-stack value to the given type, or fail with a useful error.

int                  str         bin
u8 u16 u32 u64 u128 u256
i8 i16 i32 i64 i128 i256
f16 f32 f64
42 f64       # → 42.0
3.7 int      # → 3      (truncates)
42 str       # → "42"   (number to decimal string)

Modules

namestack effectdescription
importpath →load and evaluate a file