The docs there seem to imply that fields takes a keyword or a vector, rather than a keyword or keywords. Try just (fields fields-vector), without the "apply".
On Tue, Mar 26, 2013 at 4:12 PM, Ryan <arekand...@gmail.com> wrote: > Thank you guys for your answer. apply was the first thing I used but I got > the following error: > > java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to >> clojure.lang.Associative > > > and i thought i am not going the right way. What i am more specifically > trying to do is this: > > http://sqlkorma.com/docs#select > > In the link above, the select example takes a (fields ....) function so, I > made the following wrapper because it was convenient to use in my project: > > (defn find-one-row [entity fields-vector where-hash-map] >> (first (select entity (apply fields fields-vector) (where >> where-hash-map) (limit 1)))) > > > ...but it throws the error i mentioned > > If i hardcode the fields like this, it works fine: > > (defn find-one-row [entity where-hash-map] >> (first (select entity (fields :id) (where where-hash-map) (limit 1)))) > > > Any ideas? > > > On Tuesday, March 26, 2013 9:51:34 PM UTC+2, Jim foo.bar wrote: >> >> On 26/03/13 19:28, Ryan wrote: >> > apply the elements of my vector as arguments to the function >> >> you said it yourself in your first post... :) 'apply' is what you're >> looking for! >> >> Jim >> > -- > -- > 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/groups/opt_out. > > > -- -- 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/groups/opt_out.