ilusm.dev

Syntax quick reference

Abbreviated quick reference. Go deeper with the language reference and specification.

Values

tru  fls  nil
42  3.14  "hello"  [1,2,3]  {a: 1}

Assignment & def

x = 5
def pi = 3

def binds once per scope (bytecode vs evaluator rules are spelled out in the specification).

Functions

add(a, b) = a + b

sum(xs) =
    s = 0
    x <- xs: s = s + x
    s

Control flow

max(a, b) = if a > b: a | b

n = 0
whl n < 5: n = n + 1

mat x:
    0 => prn("zero")
    _ => prn("other")

Pipelines

use trl
nums |> trl.fil(\(x) x > 0) |> trl.map(\(x) x * 2)

Modules

use fs
use txt
use jsn