Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 9277dc8e77
Fetching contributors…

Cannot retrieve contributors at this time

22 lines (15 sloc) 0.362 kb
(ns clojure.examples.factorial)
(defn fact [x]
(loop [n x f 1]
(if (= n 1)
f
(recur (dec n) (* f n)))))
(defn test [times]
(loop [rem times]
(if (> rem 0)
(do (fact 20)
(recur (dec rem))))))
;; on my machine
;; clojure jvm : 25 sec
;; clojure pypy : 48 sec
(time (test 19999999))
Jump to Line
Something went wrong with that request. Please try again.