fakir/examples/array.fk

30 lines
533 B
Plaintext
Raw Normal View History

(assert= 8 (ref [2 6 2 8 9] 3))
(assert= 9 (ref [[3 6] [9 2]] 1 0))
2023-09-23 22:40:08 +00:00
($ a ['a' [[2 true] 2.3]])
(assert= 'a' (ref a 0))
(assert= 2 (ref a 1 0 0))
2023-09-23 22:40:08 +00:00
($ (second arr)
(ref arr 1))
2023-09-23 22:40:08 +00:00
(assert= 6 (second [2 6]))
($ (produce)
[2 4 6])
(assert= 4 (second (produce)))
($ arr [2 'bim' produce false])
2023-09-24 13:54:57 +00:00
(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))