Skip to content

Instantly share code, notes, and snippets.

@swannodette
Created August 2, 2011 03:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save swannodette/1119534 to your computer and use it in GitHub Desktop.
Save swannodette/1119534 to your computer and use it in GitHub Desktop.
latest.clj
(let [x [1 2 4]]
(match [x]
[[1 2 3]] :a0
[[1 2 4]] :a1))
;; =>
(cond
(vector? x) (let [x0 (first x) x (next x)]
(cond
(= x0 1) (let [x1 (first x) x (next x)]
(cond
(= x1 2) (let
[x2 (first x) x (next x)]
(cond
(= x2 4)
(cond
(= x nil) :a1
:else
(throw
(java.lang.Exception.
"Found FailNode")))
(= x2 3)
(cond
(= x nil) :a0
:else
(throw
(java.lang.Exception.
"Found FailNode")))
:else
(throw
(java.lang.Exception.
"Found FailNode"))))
: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