Skip to content

Instantly share code, notes, and snippets.

@keyvanakbary
Created June 30, 2014 21:03
Show Gist options
  • Save keyvanakbary/dc126ed0cdf89b06b9c6 to your computer and use it in GitHub Desktop.
Save keyvanakbary/dc126ed0cdf89b06b9c6 to your computer and use it in GitHub Desktop.
; pyramid of death
(defn baz [n1 n2]
(cond (> n1 n2) (+ n1 n2)
(< n1 n2) (cond (= n1 0) 1
(= n2 0) 2
:else 3)
:else 0))
; internal extraction
(defn baz [n1 n2]
((fn [foo]
(cond (> n1 n2) (+ n1 n2)
(< n1 n2) (foo n1 n2)
:else 0))
(fn [n1 n2]
(cond (= n1 0) 1
(= n2 0) 2
:else 3))))
(baz 1 2)
; 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment