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

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