Re: similar to find-first

2009-04-27 Thread billh04
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

Re: similar to find-first

2009-04-27 Thread Mark Volkmann
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

Re: similar to find-first

2009-04-27 Thread Laurent PETIT
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

Re: similar to find-first

2009-04-27 Thread Christophe Grand
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

Re: similar to find-first

2009-04-27 Thread Laurent PETIT
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

similar to find-first

2009-04-27 Thread Mark Volkmann
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