ilo 0.11.3

ilo — a programming language for AI agents
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
-- at xs i: i-th element of a list (0-indexed).
-- Negative i counts from the end: -1 is the last element.
-- Out-of-range (i >= len or i < -len) is a runtime error.

nth xs:L n i:n>n;at xs i
last xs:L n>n;at xs -1
penultimate xs:L n>n;at xs -2

-- run: nth [10,20,30] 1
-- out: 20
-- run: nth [10,20,30] 0
-- out: 10
-- run: nth [10,20,30] 2
-- out: 30
-- run: last [10,20,30]
-- out: 30
-- run: penultimate [10,20,30]
-- out: 20