fakir/examples/array.fk

30 lines
533 B
Plaintext

(assert= 8 (ref [2 6 2 8 9] 3))
(assert= 9 (ref [[3 6] [9 2]] 1 0))
($ a ['a' [[2 true] 2.3]])
(assert= 'a' (ref a 0))
(assert= 2 (ref a 1 0 0))
($ (second arr)
(ref arr 1))
(assert= 6 (second [2 6]))
($ (produce)
[2 4 6])
(assert= 4 (second (produce)))
($ arr [2 'bim' produce false])
(assert= 6 (ref ((ref arr 2)) 2))
($ hello [2 4 6])
(assert= 4 (ref hello 1))
(ref! hello 1 12)
(assert= 12 (ref hello 1))
($ hello2 [[5 7][9 2]])
(assert= 9 (ref hello2 1 0))
(ref! (ref hello2 1) 0 34)
(assert= 34 (ref hello2 1 0))