From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: phillip.lord@newcastle.ac.uk (Phillip Lord) Newsgroups: gmane.emacs.devel Subject: Re: behaviour change in cl-subseq Date: Thu, 20 Aug 2015 21:50:00 +0100 Message-ID: <877fopadmv.fsf@russet.org.uk> References: <87pp32orsy.fsf@newcastle.ac.uk> <87zj242224.fsf@newcastle.ac.uk> <87si7v9p1l.fsf@newcastle.ac.uk> <87fv3v89af.fsf@blueberry.home> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1440103886 23283 80.91.229.3 (20 Aug 2015 20:51:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 20 Aug 2015 20:51:26 +0000 (UTC) Cc: Emacs-Devel devel To: Nicolas Petton Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Aug 20 22:51:10 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 1ZSWnh-0002vV-Qa for ged-emacs-devel@m.gmane.org; Thu, 20 Aug 2015 22:51:05 +0200 Original-Received: from localhost ([::1]:36969 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZSWng-0006lP-Ut for ged-emacs-devel@m.gmane.org; Thu, 20 Aug 2015 16:51:04 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60870) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZSWn7-0006Pb-GR for emacs-devel@gnu.org; Thu, 20 Aug 2015 16:50:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZSWmy-00046i-6D for emacs-devel@gnu.org; Thu, 20 Aug 2015 16:50:25 -0400 Original-Received: from cheviot22.ncl.ac.uk ([128.240.234.22]:37747) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZSWmy-00044M-0v for emacs-devel@gnu.org; Thu, 20 Aug 2015 16:50:20 -0400 Original-Received: from smtpauth-vm.ncl.ac.uk ([10.8.233.129] helo=smtpauth.ncl.ac.uk) by cheviot22.ncl.ac.uk with esmtp (Exim 4.63) (envelope-from ) id 1ZSWms-0006G1-FI; Thu, 20 Aug 2015 21:50:14 +0100 Original-Received: from cpc6-benw10-2-0-cust45.gate.cable.virginm.net ([92.238.179.46] helo=localhost) by smtpauth.ncl.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.63) (envelope-from ) id 1ZSWms-0000VF-GZ; Thu, 20 Aug 2015 21:50:14 +0100 In-Reply-To: <87fv3v89af.fsf@blueberry.home> (Nicolas Petton's message of "Fri, 7 Aug 2015 16:26:00 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 128.240.234.22 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:188982 Archived-At: Nico I'm wondering about this function. (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." which is "any" not "first". Minor point, and technically an implementation detail. But the more serious problem is this... ;; => nil (seq-contains-p '(1 2 3) nil) ;; => nil (seq-contains-p '(1 2 nil) nil) Which is correct by the documentation of seq-contains-p but not actually any use. Why not have it return nil or t? ;; => nil (seq-contains-p '(1 2 3) nil) ;; => t (seq-contains-p '(1 2 nil) nil) As it happens, that forces the implementation issue as well (because you can use `seq-some-p' any more for the same reason). 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. Phil