Try expanding out the expression. The macro starts with: `(-> (~query-fn-var ~@args) ~@body)
Now plug in the values: `(-> (#'insert* users) (values {:first "john" :last "doe"})) Then expand the threading macro: `(values (#'insert* users) {:first "john" :last "doe"}) So we end up with `values` taking two arguments, which is correct. - James On 21 April 2014 15:07, Hussein B. <hubaghd...@gmail.com> wrote: > Hi, > > I'm trying to study the source code of Korma project. > > (insert users > (values {:first "john" :last "doe"})) > > > This will resolve to (defmacro insert) > https://github.com/korma/Korma/blob/master/src/korma/core.clj#L143 > > > Will call (defn- make-query-then-execute) > https://github.com/korma/Korma/blob/master/src/korma/core.clj#L109 > > > What I don't get is the following: > > > `(let [query# (-> (~query-fn-var ~@args) > ~@body)] > > > (~query-fn-var ~@args) will generate a map that will be feed to (defn values) > which accepts two arguments. > > https://github.com/korma/Korma/blob/master/src/korma/core.clj#L280 > > > I expected that part to throw: > > > CompilerException clojure.lang.ArityException: Wrong number of args (1) > passed to: core/values > > But it is not. > > Any ideas why it is working? > > Thanks for help and time. > > > > > -- > 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 > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.