Created
January 1, 2014 14:29
-
-
Save jackhooper/8208442 to your computer and use it in GitHub Desktop.
Calculates the factorial of n. Written in Clojure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Calculates factorial of n | |
; Jack Hooper 2014 | |
(defn factorial [n] | |
(reduce * (range (inc n)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment