Standard library

The standard library lives in std/. The prelude is loaded automatically before every program. Other modules are loaded with import.

Prelude (auto-loaded)

Stack combinators

namestack effectdescription
dupa → a anamed alias of ,
dropa →named alias of ;
swapa b → b anamed alias of ~
overa b → a b anamed alias of _
nipa b → bdrop second
tucka b → b a bdup top, hide under second
dup2a b → a b a bdup pair
rota b c → b c arotate three
ida → aidentity (no-op)

Predicates

namestack effectdescription
zeroa → boolis zero
evena → boolis even
odda → boolis odd
ltza → boolless than zero
gtza → boolgreater than zero
dvba b → boola divisible by b

Logic

namestack effectdescription
nota → boollogical negation
anda b → boollogical and
ora b → boollogical or

Math

namestack effectdescription
inca → a+1increment
deca → a-1decrement
sqa → a*asquare
nega → -anegate
abs`a →a
sum[list] → nsum of a list
prod[list] → nproduct of a list
iotan → list[0..n-1]
mina b → mminimum
maxa b → mmaximum

Collections

namestack effectdescription
hd[list] → firsthead
flat[[..]] → [..]flatten one level
apply[args] (block) →splat args, then execute block

Misc

namedescription
dflval fallback dfl → val if truthy, fallback otherwise
peeka → a (also prints a) — debugging aid

std/math.ezc

"std/math.ezc" import
namestack effectdescription
factn → n!factorial
fibn → fib(n)nth Fibonacci
gcda b → gEuclidean GCD
pow2b e → b^einteger power for any width
clampv lo hi → v'clamp to range
sgnn → -1|0|1signum

std/str.ezc

"std/str.ezc" import
namestack effectdescription
reps n → s'repeat string n times
padls w c → s'pad-left to width with char
hass sub → boolcontains substring
startss pre → boolstarts with prefix
endss suf → boolends with suffix