Created
July 14, 2009 20:19
-
-
Save fffej/147165 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 match-if | |
"Test an arbitrary expression involving variables." | |
[pattern input bindings] | |
(dbg :patmatch (format "match-if %s %s %s" pattern input bindings)) | |
(let [f (postwalk-replace bindings (second (first pattern)))] | |
(when (eval f) | |
(pat-match (rest pattern) input bindings)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment