Domain snippets
Small programs that each exercise one stdlib area.
Below, Recorded output is whatever the current
./ilusm build printed when the page was generated-use it as a golden
transcript for docs and teaching.
Last recorded: 2026-04-07T03:18:22.710980+00:00 (UTC).
How to run
After installing Ilusm:
export ILUSM_HOME=/usr/share/ilusm ilusm release/examples/domains/trl.ilu
Or use Language demos on this site for more examples.
List map / filter (trl)
release/examples/domains/trl.ilu
Source
# Domain: trl - list map / filter use trl xs = [1, 2, 3, 4, 5] prn(trl.map(trl.fil(xs, \(x) x > 2), \(x) x * 10))
Recorded output
[30, 40, 50]
exit code: 0
String split, prefix, case (txt)
release/examples/domains/txt.ilu
Source
# Domain: txt - split, prefix, lowercase
use txt
prn(txt.spl("a|b|c", "|"))
prn(txt.pfx("ilusm", "ilu"))
prn(txtlw("OK"))
Recorded output
["a", "b", "c"] tru ok
exit code: 0
JSON objects with jsn.get (jsn)
release/examples/domains/jsn.ilu
Source
# Domain: jsn - JSON object decode / field read
use jsn
o = jsn.dec("{\"x\": 40, \"y\": 2}")
prn(jsn.get(o, "x") + jsn.get(o, "y"))
Recorded output
42
exit code: 0
JSON literals via json.decode (json)
release/examples/domains/json.ilu
Source
# Domain: json - JSON literals (pure decode)
use json
prn(json.decode("[1,2,3]"))
Recorded output
[1, 2, 3]
exit code: 0
abs, min, max (mth)
release/examples/domains/mth.ilu
Source
# Domain: mth - abs, min, max use mth prn(mthab(-7)) prn(mthmi(9, 4)) prn(mthma(9, 4))
Recorded output
7 4 9
exit code: 0
Sort lists (sort)
release/examples/domains/sort.ilu
Source
# Domain: sort - sort list ascending use sort prn(srtup([30, 10, 20]))
Recorded output
[10, 20, 30]
exit code: 0
Bitwise and / or (bit)
release/examples/domains/bit.ilu
Source
# Domain: bit - bitwise and / or use bit prn(bitan(12, 10)) prn(bitor(1, 2))
Recorded output
8 3
exit code: 0
Base64 encode (enc)
release/examples/domains/enc.ilu
Source
# Domain: enc - base64 string encode
use enc
prn(enc_btoa("ilusm"))
Recorded output
aWx1c20=
exit code: 0