Re: what when (some identity maps) mean?

2009-01-23 Thread Stuart Halloway
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

what when (some identity maps) mean?

2009-01-22 Thread wubbie
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

Re: what when (some identity maps) mean?

2009-01-22 Thread Stuart Sierra
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