Jacobo Polavieja <
jacobop...@gmail.com> writes:
Hi Jacobo,
> (not-every? #(instance? String %) stooges) ; -> false
> (some #(instance? Number %) stooges) ; -> nil
>
> Is there a reason why (some) doesn't return false also?
`some` is no predicate (else it would have a ? appended). It simply
returns the first truthy (i.e., not false nor nil) value of applying the
given fn to the elements of the fiven seq one after the other.
user> (some seq [[] (list) (hash-map) [1 2 3] [4 5]])
(1 2 3)
That said, if you use `some` with a proper predicate as you did, then
its safe to use it as a predicate, too. The fact that it returns nil
instead of false is an implementation detail, but nil is as falsy as
false, so who cares...
Bye,
Tassilo