Hi, On 2 Nov., 03:25, Mike K <mbk.li...@gmail.com> wrote:
> (print-value-a [:b 7 :a 3]) > ; actually prints nil You have to use apply. (apply print-value-a [:b 7 :a 3]). Furthermore: how could (let [{a :a} [:b 7 :a 3]] [a]) possibly work? Vectors are indexed by integers. user=> (let [{a :a} [:b 7 :a 3]] [a]) [nil] user=> (let [{a 2} [:b 7 :a 3]] [a]) [:a] The map destructuring in the defn is a special case of defn, not destructuring itself. (defn foo [& {:keys [a b]}] ...) is equivalent to (defn foo [& options#] (let [{:keys [a b]} (apply hash-map options#)] ...)) Now it should also be clear why you need apply in your example. How should Clojure decide whether the vector is one argument to the function or the whole rest argument? If you just say "sequable thing => rest argument" you wouldn't be able to pass seqs to functions with a rest argument as a last argument. Not very compelling. So you need a different way to tell Clojure what you want. And that way is apply. The implementation of (read mind) is still stuck. ;) Hope that helps. Sincerely Meikel -- 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