Skip to content

Instantly share code, notes, and snippets.

@rasmusto
Created April 25, 2014 16:53
Show Gist options
  • Save rasmusto/11296071 to your computer and use it in GitHub Desktop.
Save rasmusto/11296071 to your computer and use it in GitHub Desktop.
(defn fact [n]
(cond (zero? n) 1
:else (* n (fact (dec n)) )))
(defn fact-tail [n]
(loop [n n acc 1]
(cond (zero? n) acc
:else (recur (dec n) (* acc n)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment