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.