This is some code in a blog of William Gropper, the useage of ~'=
confused me, waiting some more detailed explain, advanced thanks

(defmacro filter
  [pred query]
  `(let [~'and (fn[& xs#] (apply str (interpose " AND " xs#)))
~'or (fn[& xs#] (apply str (interpose " OR " xs#)))
~'= (fn[x# y#] (sql-exp "=" x# y#))
~'> (fn[x# y#] (sql-exp ">" x# y#))
~'< (fn[x# y#] (sql-exp "<" x# y#))
~'like (fn[x# y#] (sql-exp "like" x# y#))
~'in (fn[x# xs#]
(str (sqlize x#) " IN (" (apply str (interpose ", " xs#)) ")"))]
     (apply str ~query " where " ~pred)))

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to