I'm having a lot of fun playing with mal-js, but I need to build a better way of storing/reusing scripts than emailing them to myself. (Or I need to build an email endpoint that evaluates mal. One or the other)
Anyway:
(def! acc (fn* (fn z args) (
if (empty? args) z
(acc fn (fn z (first args)) (rest args))
)))
(def! range (fn* (n) (
if (= n 0) ()
(cons n (range (- n 1)))
)))
(def! reverse (fn* (l) (
apply conj () l
)))
(acc str "" (reverse (range 9)))
Accumalate, generate range, and reverse (because range creates numbers in the "wrong" order). Next up is let*
.