Created
February 20, 2012 23:18
-
-
Save pauldorman/1872212 to your computer and use it in GitHub Desktop.
Nutting out the Korma 'where' macro
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
;; The original macro | |
(defmacro where | |
[query form] | |
`(let [q# ~query] | |
(where* q# | |
(bind-query q# | |
(eng/pred-map | |
~(eng/parse-where `~form)))))) | |
;; The macro with unaliasing support added | |
(defmacro where-1 | |
[query form] | |
`(let [q# ~query] | |
(where* q# | |
(bind-query q# | |
(eng/pred-map | |
~(eng/parse-where ; <- I want this to be evaluated before pred-map | |
`(unalias-form '~form ~query))))))) ; <- This is evaluated properly |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment