From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Artur Malabarba Newsgroups: gmane.emacs.devel Subject: Re: behaviour change in cl-subseq Date: Fri, 21 Aug 2015 01:02:18 +0100 Message-ID: References: <87pp32orsy.fsf@newcastle.ac.uk> <87zj242224.fsf@newcastle.ac.uk> <87si7v9p1l.fsf@newcastle.ac.uk> <87fv3v89af.fsf@blueberry.home> <877fopadmv.fsf@russet.org.uk> Reply-To: bruce.connor.am@gmail.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1440115363 7619 80.91.229.3 (21 Aug 2015 00:02:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 21 Aug 2015 00:02:43 +0000 (UTC) Cc: Nicolas Petton , Emacs-Devel devel To: Phillip Lord Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Aug 21 02:02:41 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 1ZSZn5-0004Qq-C6 for ged-emacs-devel@m.gmane.org; Fri, 21 Aug 2015 02:02:39 +0200 Original-Received: from localhost ([::1]:38058 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZSZn4-0005uM-Rl for ged-emacs-devel@m.gmane.org; Thu, 20 Aug 2015 20:02:38 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57939) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZSZmn-0005t5-Cb for emacs-devel@gnu.org; Thu, 20 Aug 2015 20:02:22 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZSZmm-0003x0-LE for emacs-devel@gnu.org; Thu, 20 Aug 2015 20:02:21 -0400 Original-Received: from mail-la0-x230.google.com ([2a00:1450:4010:c03::230]:33862) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZSZmm-0003wU-EI for emacs-devel@gnu.org; Thu, 20 Aug 2015 20:02:20 -0400 Original-Received: by laba3 with SMTP id a3so32137491lab.1 for ; Thu, 20 Aug 2015 17:02:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=xdP+SgTxkIbPLFgR0v2YY6gGE8/cFe2tNBg46gounfI=; b=Z+XtFn25pTd+dYYsjW2nCgW6UmSbx5LVD7lypEfGcyTmb52A+ntDnDNmoqxTSByYLf 9vZXZndAJjV8yYOe27TQdCYZzpHm9bG1TcjGF36C3+mWOJF+oqeKyQKALekUbr6NRneV FZ2c79RXGtB5RmYH0I3ReOJwVQidbQIxdVEfuPYr8lkraaS746BLZyhjo0GKKlnLXomX I8iFanjMIcX0tzjSkppbjoQOTU1p/kpsRpBl+l7t+fL4bjO2FWPF2DxS6d8i/nLBsaPP /vKoql1PdX8FAEM1CMaKRW4Y/OZNsaA351zUpgCmAB3z0hXtvsuBD9JhocXlNKMxLPFj j7/g== X-Received: by 10.112.205.6 with SMTP id lc6mr5136141lbc.95.1440115338414; Thu, 20 Aug 2015 17:02:18 -0700 (PDT) Original-Received: by 10.25.134.139 with HTTP; Thu, 20 Aug 2015 17:02:18 -0700 (PDT) In-Reply-To: <877fopadmv.fsf@russet.org.uk> X-Google-Sender-Auth: 7epQ7eIebDmXk7WlwO1mRLTQYsc X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c03::230 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:188990 Archived-At: > (defun seq-contains-p (seq elt &optional testfn) > "Return the first element in SEQ that equals to ELT. > Equality is defined by TESTFN if non-nil or by `equal' if nil." > (seq-some-p (lambda (e) > (funcall (or testfn #'equal) elt e)) > seq)) > > Two issues. Implementation wise, you are depending on behaviour outside > the interface of seq-some-p which says.... > > "Return any element for which (PRED element) is non-nil in SEQ, nil > otherwise." > > The other option is to add a `seq-contains-nil-p' function. > > Personally, I'd change seq-contains-p. Better to break the interface of > seq-contains-p earlier rather than later. I think both functions need to change behavior. They are named as `-p', but "return an element" is not the behavior of a boolean predicate (precisely because of the situation you describe). IMO, the current behavior of `seq-some-p' should be called `seq-some'. And the same for `seq-contains'.