[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: |
Wed, 09 Sep 2015 23:44:27 +0200 |
User-agent: |
Notmuch/0.19 (http://notmuchmail.org) Emacs/25.0.50.4 (x86_64-unknown-linux-gnu) |
Drew Adams <address@hidden> writes:
>> I meant extra complexity for the user. If seq-some was returning a
>> value, I wouldn't expect it to be a cons cell, I'd almost always want
>> the element of the sequence straight away.
>
> Well, yes. But what if the user wants the value returned by the
> function?
`seq-some', as it is now defined, is the right function to use.
> And what if the element is nil?
Then maybe seq-find is not the right function to use. Or seq-find
could, as Stephen suggested, take an optional sentinel argument for
these very rare cases.
I know that your suggestion also fixes the semantic issue, but I don't
like the cost it adds. 99% of the times, you will want the element you
searched for in the seq. I think using seq-find should remain simple
and straightforward, just like `find-if' in CL. I also had another look
at the Clojure and Scheme equivalents, and they both have a similar
corner case, though in the case of Clojure, `true' is returned instead
of `nil'.
Nico
signature.asc
Description: PGP signature
- Re: seq-some-p and nil, (continued)
- 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
- RE: seq-some-p and nil, Drew Adams, 2015/09/09
- 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, Nicolas Petton, 2015/09/08
- Re: seq-some-p and nil, David Kastrup, 2015/09/08
- Re: seq-some-p and nil, Stefan Monnier, 2015/09/08
- Re: seq-some-p and nil, Nicolas Petton, 2015/09/09
- Re: seq-some-p and nil, Nicolas Petton, 2015/09/08
- Re: seq-some-p and nil, Mark Oteiza, 2015/09/08
- Re: seq-some-p and nil, Stefan Monnier, 2015/09/08
- Re: seq-some-p and nil, Mark Oteiza, 2015/09/08