(def baz (partial merge {:opt1 "default-1" :opt2 "default-2"}))
:)
On Thu, May 12, 2016 at 5:08 PM, hiskennyness wrote:
>
>
> On Thursday, May 12, 2016 at 9:33:29 AM UTC-4, Michael Willis wrote:
>>
>> As long as we're cutting out unnecessary code, this is also equivalent:
>>
>> (defn baz [optio
On Thursday, May 12, 2016 at 9:33:29 AM UTC-4, Michael Willis wrote:
>
> As long as we're cutting out unnecessary code, this is also equivalent:
>
> (defn baz [options]
>(merge {:opt1 "default-1" :opt2 "default-2"} options))
>
>
Heh-heh, I was going to point that out. And now baz is a cripple
As long as we're cutting out unnecessary code, this is also equivalent:
(defn baz [options]
(merge {:opt1 "default-1" :opt2 "default-2"} options))
(baz {:opt1 "custom-1" :opt3 "custom-3"});;=> {:opt3 "custom-3" :opt1 "custom-1
:opt2 "default-2"}
On Thursday, May 12, 2016 at 4:03:04 AM UTC-5
Yes, only the first map passed into baz (only one passed in anyway in the
example) is kept, anything else is thrown away. Seems like a strange
example when something like this would have sufficed to get the point of
merge across:
(defn baz [options]
(let [options (merge {:opt1 "default-1" :opt2
I do not understand something this example:
https://clojuredocs.org/clojure.core/merge#example-54c7b859e4b0e2ac61831cdf
Specifically:
(defn baz [& options]
>(let [options (merge {:opt1 "default-1" :opt2 "default-2"}
> (first options))]
> options))
> (baz {:o