I've used associative destructing in the usual fashion:
some-app.core=> (def m {:a 1 :b 2})
#'some-app.core/m
some-app.core=> (let [{:keys [a b]} m] (str a "-" b))
"1-2"
but what is going on here:
some-app.core=> (def li '(:a 1 :b 2))
#'some-app.core/li
;; Wat?
some-app.core=> (let [{:keys [a b]} li] (str a "-" b))
"1-2"
I didn't think lists were associative... As in:
some-app.core=> li
(:a 1 :b 2)
some-app.core=> (associative? li)
false
;; So this is expected:
some-app.core=> (let [{a 1 b 3} li] (str a "-" b))
"-"
some-app.core=> (def v [:a 1 :b 2])
#'some-app.core/v
;; ...as is this (since vectors *are* associative):
some-app.core=> (let [{a 1 b 3} v] (str a "-" b))
"1-2"
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.