mirror of
https://github.com/carp-lang/Carp.git
synced 2024-09-11 05:25:28 +03:00
core: readd old foreach as doall
This commit is contained in:
parent
ae22172338
commit
c78c936016
@ -164,10 +164,9 @@
|
||||
(list 'ref
|
||||
(list 'str x)))
|
||||
|
||||
;; Old foreach, what's a better name for this? (it's just 'map' with side effects)
|
||||
;; (defmacro foreach [f xs]
|
||||
;; (list 'for ['i 0 (list 'Array.length (list 'ref xs))]
|
||||
;; (list f (list 'Array.nth (list 'ref xs) 'i))))
|
||||
(defmacro doall [f xs]
|
||||
(list 'for ['i 0 (list 'Array.length (list 'ref xs))]
|
||||
(list f (list 'Array.unsafe-nth (list 'ref xs) 'i))))
|
||||
|
||||
(defndynamic foreach-internal [var xs expr]
|
||||
(let [xsym (gensym-with 'xs)
|
||||
|
Loading…
Reference in New Issue
Block a user