Re: map destructuring with defaults

2011-01-06 Thread Seth
Ah. But a new map is being created with the default :or operation. I guess the ability to get this entire map with defaults is not available directly from clojure destructuring binding. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this

Re: map destructuring with defaults

2011-01-06 Thread Alan
No, no new map is created. The :or clause simply creates the local binding for you if none existed in the map; there's no need for it to create a second map to do this. On Jan 6, 6:27 pm, Seth wbu...@gmail.com wrote: Ah. But a new map is being created with the default :or operation. I guess the

map destructuring with defaults

2011-01-04 Thread Seth
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,

Re: map destructuring with defaults

2011-01-04 Thread Chas Emerick
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