From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] master 1691a51: * lisp/emacs-lisp/map.el: Make the functions generic Date: Thu, 13 Dec 2018 10:17:50 -0500 Message-ID: References: <20181211225418.14641.49501@vcs0.savannah.gnu.org> <20181211225420.1E3692092C@vcs0.savannah.gnu.org> <87o99p1p2j.fsf@tcd.ie> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1544715771 407 195.159.176.226 (13 Dec 2018 15:42:51 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 13 Dec 2018 15:42:51 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 13 16:42:47 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gXT8P-0008Mr-6M for ged-emacs-devel@m.gmane.org; Thu, 13 Dec 2018 16:42:45 +0100 Original-Received: from localhost ([::1]:53388 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXTAV-0006E7-I6 for ged-emacs-devel@m.gmane.org; Thu, 13 Dec 2018 10:44:55 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45553) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXSkb-0000PB-RT for emacs-devel@gnu.org; Thu, 13 Dec 2018 10:18:11 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gXSkW-0001j6-Us for emacs-devel@gnu.org; Thu, 13 Dec 2018 10:18:09 -0500 Original-Received: from [195.159.176.226] (port=34232 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gXSkW-0001hA-ME for emacs-devel@gnu.org; Thu, 13 Dec 2018 10:18:04 -0500 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1gXSiK-0000Yo-MY for emacs-devel@gnu.org; Thu, 13 Dec 2018 16:15:48 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 19 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:tgcOkAJTws9EcGYJFsklfAHl5P8= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:231799 Archived-At: > Why not continue to check whether lists are null, rather than traversing > their entire length: > > (cl-defmethod map-empty-p ((map list)) > (null map)) Indeed, thanks. Could you install this change? >> +(cl-defmethod map-contains-key ((map list) key &optional testfn) >> + (alist-get key map nil nil (or testfn #'equal))) > I think this should get the same treatment as the hash table method, > which checks whether DEFAULT was returned: Same here (actually, this one was a thinko: for some reason I wrote the code assuming alist-get would behave like assoc and return the cons cell). Stefan