Skip to content

Instantly share code, notes, and snippets.

@johnwesonga
Created May 2, 2020 04:57
Show Gist options
  • Save johnwesonga/aadedbca5b89f95df94625b827a5c0f6 to your computer and use it in GitHub Desktop.
Save johnwesonga/aadedbca5b89f95df94625b827a5c0f6 to your computer and use it in GitHub Desktop.
Factorial in Clojure
(defn fact
[x]
(cond
(zero? x) 1
(= x 1) 1
:else (* x (fact (dec x)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment