Skip to content

Instantly share code, notes, and snippets.

@swannodette
Created August 6, 2011 01:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save swannodette/1128891 to your computer and use it in GitHub Desktop.
Save swannodette/1128891 to your computer and use it in GitHub Desktop.
map.clj
(let [x {:a 1 :b 1}]
(match [x]
[{_ :a 2 :b}] :a0
[{1 :a _ :c}] :a1
[{3 :c _ :d 4 :e}] :a2))
;; =>
(cond
(map? x) (let [x-b6507 (:b x)]
(cond
(= x-b6507 2) (let [] :a0)
:else (let [x-a6506 (:a x)]
(cond
(= x-a6506 1) (let [] :a1)
:else (let
[x-c6508 (:c x)]
(cond
(= x-c6508 3)
(let
[x-e6510 (:e x)]
(cond
(= x-e6510 4) (let [] :a2)
:else
(throw
(java.lang.Exception.
"Found FailNode"))))
:else
(throw
(java.lang.Exception.
"Found FailNode"))))))))
:else (throw (java.lang.Exception. "Found FailNode")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment