From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Nicolas Petton Newsgroups: gmane.emacs.bugs Subject: bug#34852: 26.1; seq-intersection ignores nil as element Date: Thu, 21 Mar 2019 21:01:55 +0100 Message-ID: <87y358knd8.fsf@petton.fr> References: <87zhpxabn3.fsf@tcd.ie> <87va0lmwlg.fsf@web.de> <87d0mtpfqb.fsf@petton.fr> <87k1h1criw.fsf@tcd.ie> <87h8c0mm74.fsf@petton.fr> <87r2b1nub1.fsf@petton.fr> <87mulojf1w.fsf@tcd.ie> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="222049"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Michael Heerdegen , "Miguel V. S. Frasson" , 34852@debbugs.gnu.org, Stefan Monnier To: "Basil L. Contovounesios" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Mar 21 21:12:46 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h743Q-000veA-QV for geb-bug-gnu-emacs@m.gmane.org; Thu, 21 Mar 2019 21:12:45 +0100 Original-Received: from localhost ([127.0.0.1]:46192 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h743P-0007ts-MT for geb-bug-gnu-emacs@m.gmane.org; Thu, 21 Mar 2019 16:12:43 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:38101) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h742u-0007Qk-Ek for bug-gnu-emacs@gnu.org; Thu, 21 Mar 2019 16:12:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h73u3-0006zf-LD for bug-gnu-emacs@gnu.org; Thu, 21 Mar 2019 16:03:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40122) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h73u3-0006yb-1R for bug-gnu-emacs@gnu.org; Thu, 21 Mar 2019 16:03:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1h73u2-0007xL-TR for bug-gnu-emacs@gnu.org; Thu, 21 Mar 2019 16:03:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Nicolas Petton Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 21 Mar 2019 20:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34852 X-GNU-PR-Package: emacs Original-Received: via spool by 34852-submit@debbugs.gnu.org id=B34852.155319853030519 (code B ref 34852); Thu, 21 Mar 2019 20:03:02 +0000 Original-Received: (at 34852) by debbugs.gnu.org; 21 Mar 2019 20:02:10 +0000 Original-Received: from localhost ([127.0.0.1]:53665 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h73tC-0007wB-IN for submit@debbugs.gnu.org; Thu, 21 Mar 2019 16:02:10 -0400 Original-Received: from petton.fr ([89.234.186.68]:39524) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h73tB-0007vq-9S for 34852@debbugs.gnu.org; Thu, 21 Mar 2019 16:02:10 -0400 In-Reply-To: <87mulojf1w.fsf@tcd.ie> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=petton.fr; s=mail; t=1553198521; bh=1je1uVvG3AbRhBRseo6rXGo9hElBQDWCluRUg7ZQv3Q=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID:MIME-Version:Content-Type; b=stcxqZMrwfaJdOfMXSpG6gJIPKgJKM8/FgN8X0J/J8WnYkNuFoTpO/1psdPlMyUiO2svl1HeYxYEjXRECyqdWHimn1WJDnI/UF9DDw2a6ZPZvbcnsu9qX34S47pBlwa0gRb20DXkdx5eG1NMHG76oEqC1xhCFMqJJcUeOpA7VtE= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:156583 Archived-At: --=-=-= Content-Type: text/plain "Basil L. Contovounesios" writes: > Nicolas Petton writes: > >> (cl-defgeneric seq-contains (sequence elt &optional testfn) >> + (declare (obsolete "Use `seq-contains-p' instead." "27.1")) > > According to make-obsolete, "use instead" strings should not start with > a capital letter, but even better is (obsolete seq-contains-p "27.1"), > which adds a link to seq-contains-p in the *Help* buffer. Indeed, that's better, thank you. >> @@ -420,7 +430,7 @@ seq-sort-by >> "Return a list of the elements that appear in SEQUENCE1 but not in SEQUENCE2. >> Equality is defined by TESTFN if non-nil or by `equal' if nil." >> (seq-reduce (lambda (acc elt) >> - (if (not (seq-contains sequence2 elt testfn)) >> + (if (not (seq-contains-p sequence2 elt testfn)) >> (cons elt acc) >> acc)) > > Is there any harm in inverting this conditional structure, so that it > reads positively? It's not the purpose of this patch, but I can commit it separately. >> +(ert-deftest test-seq-contains-p () >> + (with-test-sequences (seq '(3 4 5 6)) >> + (should (eq (seq-contains-p seq 3) t)) >> + (should-not (seq-contains-p seq 7))) >> + (with-test-sequences (seq '()) >> + (should-not (seq-contains-p seq 3)) >> + (should-not (seq-contains-p seq nil)))) >> + > > I think there should also be an explicit nil membership check: > > (should (seq-contains-p [nil] nil)) > (should (seq-contains-p '(nil) nil)) Good idea! Nico --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEE1AWqLIYsVPF+7mvg6LzXhmr8+XgFAlyT7bQACgkQ6LzXhmr8 +XimvAf/ejvLLKRDKEQZg48x6yiXyuguThuKiQ/lFCih3yAZxW9MZ0G0w1PV0yRn lb5rmidqC0T1BzCEfr9MqCEoN0UBw4HMf1TxPdhk+JTxszcTFj9vkPcRYNa9l73A Vb+b1dynE1KgSWrXN2y1tvpHiOVrtrNtIZEL67DZrbRrGgGFG/X4hd7nUPJoptyb 4pOxYfdmLt7ZqB1k/wG7geuuogvEAioCpNNF5IM69t7a6N+1MBExxHTDE495pD38 jCk3xjxe5OVf8cRyZ6RU0Ek6xQGW00DKPESQcx8AJjEwqX4ksQDiJW/Rxz9FXoZV YhyqNMuPpHPXcw9tstKe/2xbn3G+Ag== =Z24X -----END PGP SIGNATURE----- --=-=-=--