1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-22 19:27:43 +00:00

Add array and tuple versions of map and for.

This commit is contained in:
Calvin Rose
2018-08-23 11:10:48 -04:00
parent 45f8db0360
commit f5b4bc4fdf
2 changed files with 56 additions and 38 deletions

View File

@@ -164,11 +164,11 @@
(testmarsh (fn name [x] x) "marshal function 1")
(testmarsh (fn [x] (+ 10 x 2)) "marshal function 2")
(testmarsh (fn thing [x] (+ 11 x x 30)) "marshal function 3")
(testmarsh map "marshal function 4")
(testmarsh reduce "marshal function 4")
(testmarsh mapa "marshal function 4")
(testmarsh reduce "marshal function 5")
# Large functions
(def manydefs (for [i :range [0 300]] (tuple 'def (gensym) (string "value_" i))))
(def manydefs (fora [i :range [0 300]] (tuple 'def (gensym) (string "value_" i))))
(array.push manydefs (tuple * 10000 3 5 7 9))
(def f (compile (tuple.prepend manydefs 'do) *env*))
(assert (= (f) (* 10000 3 5 7 9)) "long function compilation")