On Apr 27, 11:22 am, Christophe Grand wrote:
> find-first-result is already in core: some
As an aside, I would have liked (some pred coll) to return the item
that makes the pred true and the current implementation of `some to be
renamed `any? so that we would have the following:
(any? o
On Mon, Apr 27, 2009 at 11:22 AM, Christophe Grand
wrote:
>
> find-first-result is already in core: some
Ya know, I was considering not posting my code. But the thought did
occur to me that someone might point out it wasn't necessary. Thanks!
> Mark Volkmann a écrit :
>> find-first in seq_utils
2009/4/27 Christophe Grand :
>
> find-first-result is already in core: some
OH! yes :-$
>
> Mark Volkmann a écrit :
>> find-first in seq_utils returns the first item in a collection where
>> (pred item) returns logical true. I needed a function that returns the
>> result of (pred item) instead o
find-first-result is already in core: some
Mark Volkmann a écrit :
> find-first in seq_utils returns the first item in a collection where
> (pred item) returns logical true. I needed a function that returns the
> result of (pred item) instead of item. This seems to do the trick.
> Maybe this shou
Shouldn't this return nil ? :
1:4 user=> (find-first-result false? [true])
false
Maybe this definition of find-first-result may fill the gap:
(defn find-first-result [pred coll]
(find-first identity (map pred coll)))
=>
1:22 user=> (find-first-result false? [true])
nil
1:23 user=> (find-first-r
find-first in seq_utils returns the first item in a collection where
(pred item) returns logical true. I needed a function that returns the
result of (pred item) instead of item. This seems to do the trick.
Maybe this should be added to seq_utils.
(defn find-first-result [fn coll]
(first (filte