From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#45539: 26.3; `add-to-ordered-list': Add optional arg for :test predicate for hash table Date: Wed, 30 Dec 2020 21:47:45 -0800 (PST) Message-ID: <97ab6ba6-210a-4b72-9350-00e30c28d0e1@default> References: <1af7f2ac-0e6c-4c8a-860b-22148265d8aa@default> <87y2hgosxo.fsf@gnus.org> <64015d41-a84f-4ff6-a5a1-ab5d92aa20e5@default> <87k0szpyaj.fsf@gnus.org> <87v9ciociu.fsf@gnus.org> <87r1n6oawn.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9182"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 45539@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 31 06:50:23 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kuqqt-0002G3-39 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 31 Dec 2020 06:50:23 +0100 Original-Received: from localhost ([::1]:41296 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kuqqr-0006wk-Jh for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 31 Dec 2020 00:50:21 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57994) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kuqqY-0006wc-M2 for bug-gnu-emacs@gnu.org; Thu, 31 Dec 2020 00:50:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40181) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kuqqY-0003wt-5M for bug-gnu-emacs@gnu.org; Thu, 31 Dec 2020 00:50:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kuqqY-0002rM-3Y for bug-gnu-emacs@gnu.org; Thu, 31 Dec 2020 00:50:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 31 Dec 2020 05:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45539 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: fixed Original-Received: via spool by 45539-submit@debbugs.gnu.org id=B45539.160939379710974 (code B ref 45539); Thu, 31 Dec 2020 05:50:02 +0000 Original-Received: (at 45539) by debbugs.gnu.org; 31 Dec 2020 05:49:57 +0000 Original-Received: from localhost ([127.0.0.1]:51727 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kuqqT-0002qt-BY for submit@debbugs.gnu.org; Thu, 31 Dec 2020 00:49:57 -0500 Original-Received: from aserp2120.oracle.com ([141.146.126.78]:55892) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kuqqR-0002qg-OI for 45539@debbugs.gnu.org; Thu, 31 Dec 2020 00:49:56 -0500 Original-Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0BV5ivNT182793; Thu, 31 Dec 2020 05:49:49 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : message-id : date : from : sender : to : cc : subject : references : in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=VrvZnRtLzMotIm9uxds5bguviAJNrkN7rs6OI+1LrTs=; b=raNqlQvpO28wVlfXHoXpn7WeUE48vIFeAmoHe8bBbbd/XZEms339HACUGSVQAV0eAsrE eKunX/s1x1hPECDggNT6t6GWbOUILZxWKQNGr53khHSuITQfRVX6tbld2ECGZCrd+UPG rb3n8B9lNaD/1IkcQ8vPyEBeCywFamgANDTXJ9aw4I8mRGKw+IiWJKRlAcE42KVjRpkq siFoNC3Y1Wfdqv+lZKL2QVh2Zuh7h60Rj8NEmbi3nZqXCDQZBAL1iGumxQFyp02R2Kac 6OFrH+R1bdwhZ4FE9BCoL85GkZDjcCibDPhkuVr0/ql41FgyvdbWSrLecJxQAGNuKkGi Vg== Original-Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2120.oracle.com with ESMTP id 35phm1h3df-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 31 Dec 2020 05:49:49 +0000 Original-Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0BV5j3RV101957; Thu, 31 Dec 2020 05:47:48 GMT Original-Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3030.oracle.com with ESMTP id 35pf3ysu8g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 31 Dec 2020 05:47:48 +0000 Original-Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 0BV5lkGm025386; Thu, 31 Dec 2020 05:47:46 GMT In-Reply-To: <87r1n6oawn.fsf@gnus.org> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.5095.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9850 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 adultscore=0 mlxlogscore=999 suspectscore=0 spamscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012310031 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9850 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 priorityscore=1501 mlxscore=0 mlxlogscore=999 adultscore=0 bulkscore=0 malwarescore=0 spamscore=0 impostorscore=0 phishscore=0 clxscore=1015 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012310031 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:197070 Archived-At: > > It's a strange, maximally inefficient function. I'll fix it up a bit > > and add the test-function. >=20 > The complication is that test-function has to be the same in all calls > (or not given at all in subsequent calls). I don't think so. It just needs to be applicable for the particular kind(s) of list elements you have. I think you can use different TEST functions, but I'm not sure why you'd do that. But you raise a good point. Because TEST needs to be used to test list membership, as well as to be the hash-table :test, unless the default value for it suffices for testing list membership you need to provide it whenever you call the function. That's not good, and it's maybe one reason the design hard-coded `eq'. OK, I see now that there's `hash-table-test', which returns the :test defined for the hash table. We should use that, not TEST, each time for checking list membership, I think. IOW, not this: (unless (cl-member element (symbol-value list-var) :test TEST) (set list-var (cons element (symbol-value list-var)))) but this: (unless (cl-member element (symbol-value list-var) :test (hash-table-test ordering)) (set list-var (cons element (symbol-value list-var))))