Jacobo Polavieja <jacobopolavi...@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

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
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