Skip to content

Instantly share code, notes, and snippets.

@bohde
Created February 18, 2012 22:54
Show Gist options
  • Select an option

  • Save bohde/1861248 to your computer and use it in GitHub Desktop.

Select an option

Save bohde/1861248 to your computer and use it in GitHub Desktop.
(match n
0 1
_ (* n (factorial (- n 1))))
;;expands to
(try
(cond (= n 0) 1 :else (throw backtrack))
(catch
java.lang.Exception
e__7660__auto__
(if (identical? e__7660__auto__ backtrack)
(do (let [] (* n (factorial (- n 1)))))
(throw e__7660__auto__))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment