(for [[x y z] {:a "aa" :b "bb" :c "cc"}] [x y z])
   ([:c "cc" nil] [:b "bb" nil] [:a "aa" nil])    ;; WTF?

So her, I guess, your taking each entry in the map and destructuring them into 
the three vars x, y, and z. Since each map entry is a pair, the third var z 
will be nil. 

Erik. 
-- 
i farta

> Den 6. jun. 2015 kl. 13.24 skrev gvim <gvi...@gmail.com>:
> 
>> On 06/06/2015 05:01, Sean Corfield wrote:
>> Page 84 is where it shows that maps are a sequence of pairs.
>> 
>> The destructuring in James's code is on vectors -- the pairs in the
>> sequence.
>> 
>> Hope that helps?
>> 
>> Sean
> 
> Page 84 describes the sequence abstraction in general but it's the implicit 
> seq in for destructuring that threw me as I can't recall an example of it in 
> any books I've read. I don't know what to make of this, for example:
> 
> (seq {:a "aa" :b "bb" :c "cc"})
> ([:c "cc"] [:b "bb"] [:a "aa"])   ;; Fine so far
> 
> (let [[x y z] (seq {:a "aa" :b "bb" :c "cc"})] [x y z])
> [[:c "cc"] [:b "bb"] [:a "aa"]]   ;; Consistent with first example above
> 
> (for [[x y z] {:a "aa" :b "bb" :c "cc"}] [x y z])
> ([:c "cc" nil] [:b "bb" nil] [:a "aa" nil])    ;; WTF?
> 
> Taken together these make no sense to me.
> 
> gvim
> 
> -- 
> 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
> --- You received this message because you are subscribed to the Google Groups 
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to