Skip to content

Instantly share code, notes, and snippets.

@pauldorman
Created February 20, 2012 23:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pauldorman/1872212 to your computer and use it in GitHub Desktop.
Save pauldorman/1872212 to your computer and use it in GitHub Desktop.
Nutting out the Korma 'where' macro
;; 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