On 19 July 2010 09:00, Meikel Brandmeyer <m...@kotka.de> wrote: > Hi, > > On Jul 19, 8:56 am, boyan <bo...@taobao.com> wrote: > >> I have a question about apply function. >> For examle,create a hash map: >> >> user=> (hash-map :a 1 :b 2) >> {:a 1, :b 2} >> >> It works fine,but if i want to use apply: >> >> user=> (apply hash-map :a 1 :b 2) >> java.lang.IllegalArgumentException: Don't know how to create ISeq from: >> java.lang.Integer (NO_SOURCE_FILE:0) >> >> Why it throw this exception?Is apply could not work with keyword? Any >> solution? > > The last argument to apply has to be a sequence (or a thing you can > call seq on). > > (apply hash-map :a 1 [:b 2]) or (apply hash-map :a 1 :b 2 nil)
Or, perhaps what he was trying to do: user=> (apply hash-map [:a 1 :b 2]) {:a 1, :b 2} -- Michael Wood <esiot...@gmail.com> -- 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