Hi, Clojure destructuring is really awesome, but I came up with a use
case for maps that isn't supported right now as far as I know.
Currently you can get the keys that you want using the :keys keyword
and the whole map using :as.
user> (let [{:keys [a b c] :as all} {:a 1 :b 2 :c 3 :d 4}]
(println all)
(println a b c))
{:a 1, :b 2, :c 3, :d 4}
1 2 3
My problem is that I'd like to get a map with the keys that haven't
been destructured by the :keys keyword, something like:
user> (let [{:keys [a b c] :as all :rest rst} {:a 1 :b 2 :c 3 :d 4}]
(println all)
(println rst)
(println a b c))
{:a 1, :b 2, :c 3, :d 4}
{:d 4}
1 2 3
Do you think that implementing such a feature into the core/
destructure function is feasible? Is there anybody else needing it?
Thanks
--
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