Types & Functions
Every ilo function declares its parameter types and return type inline:
funcname param1:type param2:type>returntype;bodyType sigils
Section titled “Type sigils”| Sigil | Type | Description |
|---|---|---|
n | Number | Integers and floats |
t | Text | Strings |
b | Boolean | true / false |
_ | Any | Wildcard — accepts any type |
L | List | Ordered collection [1 2 3] |
M | Map | Key-value pairs {"key" "val"} |
R | Result | Success or error value |
O | Optional | Nil or a value: O n |
_ means “don’t care” — same as in match patterns. Use it for mixed-type lists (L _), results where you ignore a type (R _ t), or generic parameters (x:_).
Examples
Section titled “Examples”dbl x:n>n;*x 2 -- number → numbergreet first:t last:t>t;cat first " " last -- text params, text returntruthy x:_>b;!!x -- any type, boolean returnpi>n;3.14159 -- zero-arg functionMultiple statements
Section titled “Multiple statements”In a file, use newlines and indentation:
calc a:n b:n > n -- two numbers in, number out s = + a b -- sum p = * a b -- product + s p -- return sum + productInline, use ; instead:
ilo 'calc a:n b:n>n;s=+a b;p=*a b;+s p' 3 4Each statement binds a variable or returns a value. The last expression is the return value.