-
Notifications
You must be signed in to change notification settings - Fork 4
each
Turtle Kitty edited this page Aug 9, 2015
·
2 revisions
This operator is used to iterate over data structures.
(let (items (range 1 5) total 0)
(each n items
(set! total (+ total n))
total))
-> 15
(let (items (apply vector (range 1 5)) total 0)
(each n items
(set! total (+ total n))
total))
-> 15
(let (items (: x 1 y 2 z 3 u 4 v 5) total 0)
(each n items
(set! total (+ total n.val))
total))
-> 15