Re: Quirk of Map destructuring

2010-09-13 Thread Meikel Brandmeyer
Hi, Am 13.09.2010 um 20:54 schrieb Robert McIntyre: > I'm wondering why the symbol route was selected when the merge way may > be more convenient, or why there's something really bad about the > merge way that I'm overlooking. I find the the symbol way more consist with the different usage possi

Re: Quirk of Map destructuring

2010-09-13 Thread Robert McIntyre
Right, but the :or could conceptually just merge the supplied map with the actual supplied argument map instead -- it's just another way it could go. This is possibly a simpler model to manage in your head, since presumably you have some idea of how you want to call the function when you're writi

Re: Quirk of Map destructuring

2010-09-13 Thread Mark Nutter
On Mon, Sep 13, 2010 at 12:37 PM, Tom Hicks wrote: > > On Sep 12, 10:44 pm, Meikel Brandmeyer wrote: >> >> The default map specifies the default for the symbols which are bound, >> not the source of the values. >> >> (let [{foo :some-key bar "some-other-key" :or {foo 1}} ] ...) > > Sorry Meik

Re: Quirk of Map destructuring

2010-09-13 Thread Tom Hicks
On Sep 12, 10:44 pm, Meikel Brandmeyer wrote: > Hi, > > On 13 Sep., 04:30, Robert McIntyre wrote: > > > Unless there's a good reason for :or to work the way it does I think > > that would be a good idea, since then you can define "default" maps > > somewhere else and use those both with the :or

Re: Quirk of Map destructuring

2010-09-12 Thread Meikel Brandmeyer
Hi, On 13 Sep., 04:30, Robert McIntyre wrote: > Unless there's a good reason for :or to work the way it does I think > that would be a good idea, since then you can define "default" maps > somewhere else and use those both with the :or keyword or when > calling the function itself. The default

Re: Quirk of Map destructuring

2010-09-12 Thread Robert McIntyre
I've been bitten by this before. Unless there's a good reason for :or to work the way it does I think that would be a good idea, since then you can define "default" maps somewhere else and use those both with the :or keyword or when calling the function itself. Maybe the :or map can just be under

Quirk of Map destructuring

2010-09-12 Thread Tom Hicks
I just noticed this unexpected result for Map destructuring with an :or directive: user=> (def guys-name-map {:f-name "Guy" :l-name "Steele"}) #'user/guys-name-map user=> (let [{:keys [f-name m-name l-name] :or {:m-name "CL"}} guys- name-map] (str l-name ", " f-name "+" m-name)) "Steele, Guy+"