The :as option in destructuring forms binds the original value being
destructured -- no "entire" map is being formed in the background ahead of time.
So, build that "entire" map as you require; e.g.:
=> (let [{:keys [a] :as b} (merge {:b 3} {:a 4})] b)
{:a 4, :b 3}
- Chas
On Jan 4, 2011, at 7:38 PM, Seth wrote:
> Is there any way to get the entire map when destructuring plus the
> defaults?
> (let [{:keys [a] :or {a 4} :as b} {:b 3}] b)
> returns {:b 3}
>
> but i would like it to return {:b 3 :a 4}
>
> --
> 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 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