Add set index in list, and update lib+examples+tests

This commit is contained in:
Neemek 2026-08-20 13:44:10 +02:00
parent 8d12c0bdf8
commit 0f905a7fea
Signed by: neemek
GPG key ID: 84FFE4D7D40AB25E
12 changed files with 117 additions and 60 deletions

View file

@ -34,3 +34,10 @@ assertEq("the, first, time".split(", "), ["the", "first", "time"])
# list indexing
assertEq([1, 2, 3].at(1), 2)
assertEq(["a", "b", "c"].at(2), "c")
# mutating list
a := [1, 2, 3]
assertEq(a, [1, 2, 3])
a[1] = 4
assertEq(a, [1, 4, 3])

View file

@ -9,3 +9,10 @@ fn neighbours(n: int) -> (int, int) {
}
assertEq(neighbours(2), (1, 3))
a := (1, 2)
assertEq(a, (1, 2))
(x, y) := a
assertEq(x, 1)
assertEq(y, 2)