From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nicolas Petton Newsgroups: gmane.emacs.devel Subject: RE: seq-some-p and nil Date: Wed, 09 Sep 2015 23:44:27 +0200 Message-ID: <87si6nw9ms.fsf@petton.fr> References: <1441295429.4215.0@smtp.gmail.com> <87si6vl21r.fsf@petton.fr> <878u8k2vnp.fsf@udel.edu> <878u8i69ok.fsf@petton.fr> <674102d7-0e97-478a-af05-ca6d82c17c28@default> <87mvwym01x.fsf@petton.fr> <87h9n5mloa.fsf@petton.fr> <8737ypm547.fsf@petton.fr> <87pp1s976u.fsf@fencepost.gnu.org> <3dc0f1d9-caf1-446a-ab14-2b3e210a02e7@default> <87r3m8lop9.fsf@petton.fr> <87y4ggf2km.fsf@petton.fr> <86617ca2-a339-4df0-ba05-7f33c2b2cfd0@default> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-Trace: ger.gmane.org 1441835093 23148 80.91.229.3 (9 Sep 2015 21:44:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 9 Sep 2015 21:44:53 +0000 (UTC) Cc: Mark Oteiza , emacs-devel@gnu.org To: Drew Adams , David Kastrup , Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Sep 09 23:44:39 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZZnAT-00005J-QB for ged-emacs-devel@m.gmane.org; Wed, 09 Sep 2015 23:44:37 +0200 Original-Received: from localhost ([::1]:45890 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZnAT-00024F-Qd for ged-emacs-devel@m.gmane.org; Wed, 09 Sep 2015 17:44:37 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44705) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZnAQ-000247-GT for emacs-devel@gnu.org; Wed, 09 Sep 2015 17:44:35 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZZnAM-00073f-Gr for emacs-devel@gnu.org; Wed, 09 Sep 2015 17:44:34 -0400 Original-Received: from out2-smtp.messagingengine.com ([66.111.4.26]:38021) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZnAM-00073X-Cs for emacs-devel@gnu.org; Wed, 09 Sep 2015 17:44:30 -0400 Original-Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id F11212065D for ; Wed, 9 Sep 2015 17:44:29 -0400 (EDT) Original-Received: from frontend1 ([10.202.2.160]) by compute4.internal (MEProxy); Wed, 09 Sep 2015 17:44:29 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=tYGPRmAR/dH4gwv6RidTyKK+t00=; b=qOtL0 gDuuCDzp176k3lnGBn7RlNDb6qJXrg9n2gCxY1voOnXYhZmFF+p/PadovWYL0qQj OVEjzuAgJwj8c4+dLKtEfQnFHIY2S4sbpOiWJxYQpZK36VJNfawyIfeFwreDpBKH 9iZwEm6hLNBwhpdkwe3xSrfQR3dXZzs21xNFRY= X-Sasl-enc: L06ZtM6Or/8ZQlrwgpY/Dk0s52u621D+IQwYZB7Yj+OQ 1441835069 Original-Received: from blueberry (arennes-658-1-183-218.w92-139.abo.wanadoo.fr [92.139.0.218]) by mail.messagingengine.com (Postfix) with ESMTPA id 0ACA9C0001B; Wed, 9 Sep 2015 17:44:28 -0400 (EDT) In-Reply-To: <86617ca2-a339-4df0-ba05-7f33c2b2cfd0@default> User-Agent: Notmuch/0.19 (http://notmuchmail.org) Emacs/25.0.50.4 (x86_64-unknown-linux-gnu) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.26 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:189778 Archived-At: --=-=-= Content-Type: text/plain Drew Adams 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 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: GPGTools - http://gpgtools.org iQEcBAEBCAAGBQJV8Kg7AAoJECM1h6R8IHkQuZMH/0VetoJ/WPhJtjmC6p03oCBB Hy2QMuDjFH87T4hlbjmDmPq/iPDYJ1bVn0hDk0LD9cjYpPu/HyOkWZpbd5Rzu/g7 Xo2+whHkZwZa9kHrdkezeFEkRnyX5gbj8t4Sjyoh4OofW1gN5c/+HHyvO35sdcAx NSSTTnsHsUCxbcM5Zpe6toxu97nzbopxKCxDUjVTaTsdIWOebHOtM1w2xJcB2GNR GDjsga1Dm0sUn7XqEQAKCt3dBqb6+SZldhOPvsCMYAovNr0yy3Z62kiNkJjDbZm4 vT/642ZreQgjP7ZtxhWxc5Fmsj3802a9zV5YKmuPQf4R+LHv43qtV4ks0HtoJ5w= =P7dF -----END PGP SIGNATURE----- --=-=-=--