On Aug 28, 8:13 am, Chouser <[EMAIL PROTECTED]> wrote:
> On Wed, Aug 27, 2008 at 10:37 PM, Parth Malwankar
>
> <[EMAIL PROTECTED]> wrote:
> > In case the access path were vectors the above could become:
>
> > (mk-get my-fridge (item-path :mango) :quantity)
> > (mk-assoc my-fridge (item-path :mango) :quantity new-quantity)
>
> > Much less noise.
>
> apply actually can do the conj'ing for you:
>
> (apply mk-get my-fridge (item-path :mango) :quantity)
I get an error with this.
user=> (item-path :mango)
[:fruits :mango]
user=> (apply mk-get my-fridge (item-path :mango) :quantity)
java.lang.IllegalArgumentException: Don't know how to create ISeq
from: Keyword : :quantity
java.lang.IllegalArgumentException: Don't know how to create ISeq
from: Keyword : :quantity
at clojure.lang.RT.seqFrom(RT.java:461)
at clojure.lang.RT.seq(RT.java:444)
at clojure.seq__28.invoke(boot.clj:92)
at clojure.spread__132.invoke(boot.clj:357)
at clojure.spread__132.invoke(boot.clj:358)
at clojure.spread__132.invoke(boot.clj:358)
at clojure.apply__135.doInvoke(boot.clj:364)
at clojure.lang.RestFn.invoke(RestFn.java:460)
at user.eval__2237.invoke(Unknown Source)
at clojure.lang.Compiler.eval(Compiler.java:3847)
at clojure.lang.Repl.main(Repl.java:75)
user=> (apply mk-get my-fridge (conj (item-path :mango) :quantity))
30
Is this supposed to work? If it does it will be very convenient.
Parth
>
> --Chouser
--~--~---------~--~----~------------~-------~--~----~
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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---