From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.devel Subject: RE: seq-some-p and nil Date: Mon, 7 Sep 2015 01:06:51 -0700 (PDT) Message-ID: <674102d7-0e97-478a-af05-ca6d82c17c28@default> References: <1441295429.4215.0@smtp.gmail.com> <87si6vl21r.fsf@petton.fr> <878u8k2vnp.fsf@udel.edu> <878u8i69ok.fsf@petton.fr> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1441613252 11306 80.91.229.3 (7 Sep 2015 08:07:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 7 Sep 2015 08:07:32 +0000 (UTC) Cc: emacs-devel@gnu.org To: Nicolas Petton , Stefan Monnier , Mark Oteiza Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Sep 07 10:07:20 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 1ZYrSL-00008k-LP for ged-emacs-devel@m.gmane.org; Mon, 07 Sep 2015 10:07:13 +0200 Original-Received: from localhost ([::1]:54331 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYrSL-0000fv-Ae for ged-emacs-devel@m.gmane.org; Mon, 07 Sep 2015 04:07:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60747) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYrSH-0000ff-H0 for emacs-devel@gnu.org; Mon, 07 Sep 2015 04:07:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZYrSD-0001SE-Bw for emacs-devel@gnu.org; Mon, 07 Sep 2015 04:07:09 -0400 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:25428) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYrSD-0001Ry-6C for emacs-devel@gnu.org; Mon, 07 Sep 2015 04:07:05 -0400 Original-Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t8787282022386 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 7 Sep 2015 08:07:03 GMT Original-Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.13.8/8.13.8) with ESMTP id t87870Zu002433 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Mon, 7 Sep 2015 08:07:00 GMT Original-Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id t87870au004055; Mon, 7 Sep 2015 08:07:00 GMT In-Reply-To: <878u8i69ok.fsf@petton.fr> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9 (901082) [OL 12.0.6691.5000 (x86)] X-Source-IP: userv0022.oracle.com [156.151.31.74] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 141.146.126.69 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:189665 Archived-At: > >> I also liked seq-some-p returning the matching element over cl-some > >> returning the value returned by the predicate. > > > > But if the matched element is nil ... >=20 > 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. 1. That's too big a weakness. It means that `seq-some' cannot be used as a predicate. (Again, lose the suffix `-p' if the return value is important as something other than a Boolean.) 2. You can return both the sequence element and the value of the predicate applied to it, as a cons: (ELEMENT . VALUE). If the element is nil then the return value is (nil . VALUE). That gives you both kinds of info, at the cost of a cons and the trouble to dig out what you need from the cons. 3. If you never care about the VALUE, you could just return a cons with the sequence element. For nil the return value would then be (nil). #2 sounds reasonable.