On Mon, 1 Nov 2010 19:25:59 -0700 (PDT) Mike K <mbk.li...@gmail.com> wrote:
> This question is a bit abstruse, so please bear with me :-) [elided] > So this can't be how it works, but I don't know how else to interpret > the documentation. Is this a special case meaning "if there are > optional arguments AND they are to be destructured via a map, then > insert them pairwise into a map instead of a vector"? Or does this > behavior fall directly out of the destructuring rules without a > special case based on something I'm missing? My gut reaction is that you found a bug. This behavior was added in 1.2, as noted in the change log: == 2.3 Destructuring Enhanced == If you associatively destructure a seq, it will be poured into a map first: (defn foo [& {:keys [a b c]}] [a b c]) (foo :c 3 :b 2) => [nil 2 3] I don't see anything about "optional arguments" there, just that using a map to destructure a sequence should cause it to be converted to a map. Which to me means your second (failing) example ought to work, so that: user=> (let [{a :a} [:a 2 :b 3]] [a]) [nil] should return [2], not [nil]. Unfortunately, the doc at http://clojure.org/special_forms on bindings doesn't cover this case. Given that the doc I did found was a change log, I wouldn't put to much credence on it - those generally aren't definitive. But I'd like to see a definitive answer as well. <mike -- Mike Meyer <m...@mired.org> http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O< ascii ribbon campaign - stop html mail - www.asciiribbon.org -- 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