I don't think the function passed to "some" should be called a  
predicate, since it is not constrained to true/false. The docstring  
agrees with you, however.

Stuart

> Hi,
>
> It means that some of the maps can be nil, but at least one of them
> has to be non-nil. "some" requires a predicate, but since nil is
> logical false, we can just use "identity".  Here's the behavior:
>
>    user> (merge nil nil nil)
>    nil
>    user> (merge {:a 1} nil {:b 2})
>    {:b 2, :a 1}
>
> -Stuart Sierra
>
>
> On Jan 22, 7:16 pm, wubbie <sunj...@gmail.com> wrote:
>> Hi,
>>
>> Here is def of merge:
>>
>> (defn merge
>>
>>   [& maps]
>>   (when (some identity maps)
>>     (reduce #(conj (or %1 {}) %2) maps)))
>>
>> How can I interpret  when (some identity maps)?
>>
>> Thanks
>> -sun
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to