The main use case for the non-boolean aspect of `some` is when you use it
to find the first element of a sequence that is in a particular set.

(some #{....} [....])

The idea is that when you get a "hit", the return value is the specific
element of the *set* that matched.  This is a useful trick for turning
values into something canonical that can be compared with your canonical
values using identical?

=> (def a (with-meta [1 2] {:canonical true}))
=> (some #{a} [(list 1 2)])
[1 2]
=> (meta (some #{a} [(list 1 2)]))
{:canonical true}
=> (identical? a (some #{a} [(list 1 2)]))
true


On Sun, Apr 26, 2015 at 12:02 AM, Isaac Zeng <ndtm.i...@gmail.com> wrote:

> some
>
>
> On Sunday, April 26, 2015 at 9:32:09 AM UTC+8, Colin Taylor wrote:
>>
>> Any reason why we don't have `any?`. Googled without much luck.
>> Trivially done as `comp boolean some` not doubt, but I know I use it more
>> than not-any at least.
>> It's particularly useful as a composable `or`.
>>
>>
>>  --
> 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
> ---
> 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 clojure+unsubscr...@googlegroups.com.
> 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 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
--- 
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to