ilo 0.8.2

ilo — a programming language for AI agents
-- Built-in functions: str, len, abs, min, max, has, cat.
-- Called like functions, compiled to dedicated opcodes — no overhead.
-- Note: comparison operators (=, <, >, <=, >=) start braceless guards, not return expressions.
-- So a non-last function can't end with a comparison. Use binary arithmetic (+x 0, +r "") instead.

-- Number of digits in an integer (non-last — bind len result, end with binary +l 0)
digs n:n>n;t=str n;l=len t;+l 0

-- Clamp using min + max (non-last — each call bound; end with binary +u 0)
clamp n:n lo:n hi:n>n;t=min n hi;u=max lo t;+u 0

-- Join a list of words with a space (non-last — bind result; +r "" = r, safe)
join ws:L t>t;r=cat ws " ";+r ""

-- Does a substring appear in a text? (last function — bare call safe at EOF)
has-word sentence:t word:t>b;has sentence word

-- run: digs 12345
-- out: 5
-- run: digs 7
-- out: 1
-- run: clamp 150 0 100
-- out: 100
-- run: clamp 50 0 100
-- out: 50
-- run: join [hello,world,foo]
-- out: hello world foo
-- run: has-word hello-world world
-- out: true
-- run: has-word hello-world foo
-- out: false