Hi,

On 2 Nov., 07:41, Meikel Brandmeyer <m...@kotka.de> wrote:
> Hi,
>
> On 2 Nov., 03:25, Mike K <mbk.li...@gmail.com> wrote:

> 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#)] ...))

Scratch that. I'm wrong. It really is a feature of destructuring
itself. The issue is: a vector is not a seq.

user=> (let [{a :a} [:b 7 :a 3]] [a])
[nil]
user=> (let [{a 2} [:b 7 :a 3]] [a])
[:a]
user=> (let [{a :a} (seq [:b 7 :a 3])] [a])
[3]

And that also works for your example, which I completely misread.

user=> (defn foo [{:keys [a b]}] [a])
#'user/foo
user=> (foo [:b 7 :a 5])
[nil]
user=> (foo (seq [:b 7 :a 5]))
[5]

Sorry for the noise.

Take aways: 1) Don't write emails before first coffee. And 2)
datastructures and seqs are different things.

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

Reply via email to