From: Nicolas Petton <nicolas@petton.fr>
To: Drew Adams <drew.adams@oracle.com>, David Kastrup <dak@gnu.org>,
Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Mark Oteiza <mvoteiza@udel.edu>, emacs-devel@gnu.org
Subject: RE: seq-some-p and nil
Date: Wed, 09 Sep 2015 23:44:27 +0200 [thread overview]
Message-ID: <87si6nw9ms.fsf@petton.fr> (raw)
In-Reply-To: <86617ca2-a339-4df0-ba05-7f33c2b2cfd0@default>
[-- Attachment #1: Type: text/plain, Size: 1016 bytes --]
Drew Adams <drew.adams@oracle.com> 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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 512 bytes --]
next prev parent reply other threads:[~2015-09-09 21:44 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-03 15:50 seq-some-p and nil Simen Heggestøyl
2015-09-03 16:42 ` Stefan Monnier
2015-09-03 17:19 ` Artur Malabarba
2015-09-03 17:35 ` John Mastro
2015-09-03 17:50 ` Drew Adams
2015-09-03 19:36 ` Nicolas Petton
2015-09-03 19:45 ` Nicolas Petton
2015-09-06 1:17 ` Mark Oteiza
2015-09-06 20:48 ` Nicolas Petton
2015-09-06 21:46 ` Stefan Monnier
2015-09-07 6:11 ` Nicolas Petton
2015-09-07 8:06 ` Drew Adams
2015-09-07 15:19 ` Stefan Monnier
2015-09-07 15:23 ` Mark Oteiza
2015-09-07 17:08 ` Drew Adams
2015-09-07 20:44 ` Nicolas Petton
2015-09-07 22:27 ` Stefan Monnier
2015-09-08 7:09 ` Nicolas Petton
2015-09-08 12:36 ` Stefan Monnier
2015-09-08 13:07 ` Nicolas Petton
2015-09-08 16:49 ` Stefan Monnier
2015-09-08 17:01 ` David Kastrup
2015-09-08 17:08 ` Drew Adams
2015-09-08 19:02 ` Nicolas Petton
2015-09-08 19:48 ` Drew Adams
2015-09-09 7:56 ` Nicolas Petton
2015-09-09 13:26 ` Drew Adams
2015-09-09 17:45 ` Stefan Monnier
2015-09-09 17:53 ` Drew Adams
2015-09-09 20:24 ` Stefan Monnier
2015-09-09 20:46 ` Drew Adams
2015-09-09 21:44 ` Nicolas Petton [this message]
2015-09-08 18:43 ` Stefan Monnier
2015-09-08 19:03 ` David Kastrup
2015-09-08 18:59 ` Nicolas Petton
2015-09-08 19:06 ` David Kastrup
2015-09-08 20:33 ` Stefan Monnier
2015-09-09 7:57 ` Nicolas Petton
2015-09-08 13:21 ` Nicolas Petton
2015-09-08 13:37 ` Mark Oteiza
2015-09-08 17:50 ` Stefan Monnier
2015-09-09 2:19 ` Mark Oteiza
2015-09-09 4:28 ` Stephen J. Turnbull
2015-09-09 4:57 ` Mark Oteiza
2015-09-07 20:45 ` Nicolas Petton
2015-09-03 19:40 ` Nicolas Petton
2015-09-10 17:46 ` Simen Heggestøyl
2015-09-10 22:12 ` Nicolas Petton
2015-09-22 17:17 ` Simen Heggestøyl
2015-09-23 8:38 ` Nicolas Petton
2015-09-23 8:44 ` David Kastrup
2015-09-23 8:48 ` Simen Heggestøyl
2015-09-23 10:57 ` Nicolas Petton
2015-09-28 19:17 ` Nicolas Petton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87si6nw9ms.fsf@petton.fr \
--to=nicolas@petton.fr \
--cc=dak@gnu.org \
--cc=drew.adams@oracle.com \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
--cc=mvoteiza@udel.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.