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 "default-2"}
options)]
options))
(baz {:opt1 "custom-1" :opt3 "custom-3"});;=> {:opt3 "custom-3" :opt1
"custom-1 :opt2 "default-2"}
On Thu, 12 May 2016 at 07:45 hiskennyness <[email protected]> wrote:
> 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 {:opt1 "custom-1" :opt3 "custom-3"});;=> {:opt3 "custom-3" :opt1
>> "custom-1 :opt2 "default-2"}
>>
>>
> IIANM, that throws away all but the first map in the rest parameter
> options.
>
> Is there more going on here than I realize?
>
> --
> 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 unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.