A fork of Crisp for HARP
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

28 lines
800 B

(load-file "../core.mal")
(load-file "../perf.mal")
;;(prn "Start: basic macros/atom test")
(def! atm (atom (list 0 1 2 3 4 5 6 7 8 9)))
(println "iters/s:"
(run-fn-for
(fn* []
(do
(or false nil false nil false nil false nil false nil (first @atm))
(cond false 1 nil 2 false 3 nil 4 false 5 nil 6 "else" (first @atm))
(-> (deref atm) rest rest rest rest rest rest first)
(swap! atm (fn* [a] (concat (rest a) (list (first a)))))))
10))
;;(def! sumdown (fn* (N) (if (> N 0) (+ N (sumdown (- N 1))) 0)))
;;(def! fib (fn* (N) (if (= N 0) 1 (if (= N 1) 1 (+ (fib (- N 1)) (fib (- N 2)))))))
;;
;;(println "iters/s:"
;; (run-fn-for
;; (fn* []
;; (do
;; (sumdown 10)
;; (fib 12)))
;; 3))
;;(prn "Done: basic macros/atom test")