Skip to content

Instantly share code, notes, and snippets.

@swannodette
Created August 2, 2011 04:23
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/1119599 to your computer and use it in GitHub Desktop.
Save swannodette/1119599 to your computer and use it in GitHub Desktop.
maranget.clj
(let [w 0 x 1 y 2 z 3]
(dotimes [_ 10]
(time
(dotimes [_ 1e8]
(match [w x y z]
[_ 2 1 3] :a0
[1 2 _ 1] :a1
[1 4 3 5] :a2)))))
;; =>
(cond
(= x 4) (cond
(= w 1) (cond
(= y 3) (cond
(= z 5) :a2
:else
(throw
(java.lang.Exception.
"Found FailNode")))
:else (throw
(java.lang.Exception. "Found FailNode")))
:else (throw (java.lang.Exception. "Found FailNode")))
(= x 2) (cond
(= y 1) (cond
(= z 1) (cond
(= w 1) :a1
:else
(throw
(java.lang.Exception.
"Found FailNode")))
(= z 3) :a0
:else (throw
(java.lang.Exception. "Found FailNode")))
:else (cond
(= w 1) (cond
(= z 1) :a1
: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