ilo 0.12.0

ilo - the token-minimal programming language AI agents write
Documentation
-- Bare-bool ternary: `?subj{a}{b}` evaluates to `a` when subj is
-- true, else `b`. Symmetric with the existing `=cond{a}{b}` form
-- for comparison-led conditions — the `?` form is the natural
-- shape when the condition is already a bool (param, comparison
-- result, predicate call).
--
-- Previously this shape parsed as match-on-bool and errored with
-- `expected Colon, got RBrace` because `a` was read as a pattern
-- requiring `:body`. Workaround was the prefix ternary
-- `?=h true a b`. Both forms still parse; the sugar saves ~5
-- characters per occurrence on the highest-frequency conditional
-- shape in agent-written ilo.

basic h:b>n;?h{1}{0}
strings h:b>t;?h{"yes"}{"no"}

-- Arms can be calls, prefix-op expressions, or composed calls.
calc h:b>n;?h{+1 2}{*3 4}

-- Subject can be a comparison result bound to a local.
pos x:n>t;c=>x 0;?c{"pos"}{"nonpos"}

-- Assignment shape — ternary in RHS position.
pick h:b>n;v=?h{10}{20};v

-- Match on bool with explicit arms still works for cases where you
-- want the symmetry of `true:` / `false:` arm labels.
arms h:b>n;?h{true:10;false:20}

-- Unbraced prefix form on a bare-bool subject: `?h a b`.
-- Symmetric with the existing `?=cond a b` prefix ternary (which
-- requires a comparison op after `?`). Cheapest shape when both
-- arms are bare atoms — 6 chars for `?h 1 0` vs 8 for `?h{1}{0}`
-- vs 12 for the older workaround `?=h true 1 0`.
unbraced h:b>n;?h 1 0
unbraced-t h:b>t;?h "yes" "no"

-- Unbraced form in expression position (let RHS).
unbraced-pick h:b>n;v=?h 10 20;v

-- Unbraced form with prefix-op arms (`+1 2` / `*3 4`).
unbraced-calc h:b>n;?h +1 2 *3 4

-- run: basic true
-- out: 1

-- run: basic false
-- out: 0

-- run: strings true
-- out: yes

-- run: strings false
-- out: no

-- run: calc true
-- out: 3

-- run: calc false
-- out: 12

-- run: pos 5
-- out: pos

-- run: pos 0
-- out: nonpos

-- run: pick true
-- out: 10

-- run: pick false
-- out: 20

-- run: arms true
-- out: 10

-- run: arms false
-- out: 20

-- run: unbraced true
-- out: 1

-- run: unbraced false
-- out: 0

-- run: unbraced-t true
-- out: yes

-- run: unbraced-t false
-- out: no

-- run: unbraced-pick true
-- out: 10

-- run: unbraced-pick false
-- out: 20

-- run: unbraced-calc true
-- out: 3

-- run: unbraced-calc false
-- out: 12