[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: seq-some-p and nil
From: |
Nicolas Petton |
Subject: |
Re: seq-some-p and nil |
Date: |
Mon, 07 Sep 2015 22:44:42 +0200 |
User-agent: |
Notmuch/0.19 (http://notmuchmail.org) Emacs/25.0.50.4 (x86_64-unknown-linux-gnu) |
Stefan Monnier <address@hidden> writes:
>>> If the function is not supposed to return non-nil if an element is
>>> matched but the element itself, then would it be ok? OTOH there would be
>>> again no way to differentiate between no element found and nil being
>>> found in the sequence.
>
> Returning what FUN returned seems like a better choice.
>
> If you need the element matched, then you can simply arrange for FUN
> to return the element.
There is a misunderstanding here I think.
The way I see it, they are two different functions: the (new) seq-some,
and this other function that is now missing in seq, with the new
implementation of `seq-some'.
This new function would be used to find an element in a seq using a
predicate. CL has `find-if,' Scheme has `find', Clojure has `some',
Smalltalk has `detect:', etc.
Also, both the CL and scheme versions have the nil value ambiguity, but
since these functions are not supposed to return the logical truth on a
match, it is in my opinion fine.
I think I could name this function `seq-find'.
Cheers,
Nico
--
Nicolas Petton
http://nicolas-petton.fr
signature.asc
Description: PGP signature
- RE: seq-some-p and nil, (continued)
- RE: seq-some-p and nil, Nicolas Petton, 2015/09/03
- Re: seq-some-p and nil, Nicolas Petton, 2015/09/03
- Re: seq-some-p and nil, Mark Oteiza, 2015/09/05
- Re: seq-some-p and nil, Nicolas Petton, 2015/09/06
- Re: seq-some-p and nil, Stefan Monnier, 2015/09/06
- Re: seq-some-p and nil, Nicolas Petton, 2015/09/07
- RE: seq-some-p and nil, Drew Adams, 2015/09/07
- Re: seq-some-p and nil, Stefan Monnier, 2015/09/07
- Re: seq-some-p and nil, Mark Oteiza, 2015/09/07
- RE: seq-some-p and nil, Drew Adams, 2015/09/07
- Re: seq-some-p and nil,
Nicolas Petton <=
- Re: seq-some-p and nil, Stefan Monnier, 2015/09/07
- Re: seq-some-p and nil, Nicolas Petton, 2015/09/08
- Re: seq-some-p and nil, Stefan Monnier, 2015/09/08
- Re: seq-some-p and nil, Nicolas Petton, 2015/09/08
- Re: seq-some-p and nil, Stefan Monnier, 2015/09/08
- Re: seq-some-p and nil, David Kastrup, 2015/09/08
- RE: seq-some-p and nil, Drew Adams, 2015/09/08
- RE: seq-some-p and nil, Nicolas Petton, 2015/09/08
- RE: seq-some-p and nil, Drew Adams, 2015/09/08
- RE: seq-some-p and nil, Nicolas Petton, 2015/09/09