Ownership
Values move on use. & borrows. copy makes a new owner.
main (print)
# [int] takes ownership: the caller's list moves in and a new one moves out.
append(xs [int], x int) [int]
[*xs, x]
# &[int] borrows: the function may read but not consume or extend.
total(xs &[int]) int
update sum = 0 to sum + x for x in stream(xs)
sum
main()
xs = [int: 1, 2]
xs = append(xs, 3)
a = total(xs)
b = total(xs)
# copy makes a new owner; the original is untouched.
ys = append(copy(xs), 4)
print.line("{a} {b} {len(xs)} {len(ys)}")6 6 3 4