[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: |
Tue, 08 Sep 2015 15:07:36 +0200 |
User-agent: |
Notmuch/0.19 (http://notmuchmail.org) Emacs/25.0.50.4 (x86_64-unknown-linux-gnu) |
Stefan Monnier <address@hidden> writes:
>> Can you elaborate on why you think it's not worth it?
>
>> IMO, finding an element in a sequence is a very common operation,
>
> Conceptually, yes, but if you take into account the details of how you
> specify which element you want, as well as what you want to do with it,
> then in most cases, I think the code ends up just as simple with
> seq-some as with seq-find.
I don't follow. How can the code end up just as simple when finding an
element matching a predicate?
To make things easier to understand, I'm taking the example of finding
the first odd number in a seq:
(seq-some (lambda (elt) (and (oddp elt) elt))
'(0 1 2 3))
(seq-find #'oddp '(0 1 2 3))
The first version is not only much harder to read, it also IMO shows
that the lambda mostly re-implement what a `seq-find' function should
provide by default in the library.
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, 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, 2015/09/07
- 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 <=
- 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
- RE: seq-some-p and nil, Drew Adams, 2015/09/09
- Re: seq-some-p and nil, Stefan Monnier, 2015/09/09
- RE: seq-some-p and nil, Drew Adams, 2015/09/09
- Re: seq-some-p and nil, Stefan Monnier, 2015/09/09