Skip to content

Instantly share code, notes, and snippets.

@lenaschoenburg
Created January 21, 2013 14:26
Show Gist options
  • Save lenaschoenburg/4586422 to your computer and use it in GitHub Desktop.
Save lenaschoenburg/4586422 to your computer and use it in GitHub Desktop.
(defn sc [p]
"Returns a function that matches data with pattern"
(fn [data]
(loop [d data
c p]
(if (seq c)
(if (seq d)
(if (= (first c)
(first d))
(recur (rest d) (rest c))
(recur (rest d) p))
nil)
d))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment