Created
January 21, 2013 14:26
-
-
Save lenaschoenburg/4586422 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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