From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#25929: 25.2; map-delete doesn't delete permanently 1st alist elt Date: Tue, 21 Mar 2017 21:41:01 +0100 Message-ID: References: <87k288p2oq.fsf@gmail.com> <87k288kkqr.fsf@petton.fr> <87efyfluvi.fsf@petton.fr> <87efydlxfh.fsf@drachen> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1490128939 19066 195.159.176.226 (21 Mar 2017 20:42:19 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 21 Mar 2017 20:42:19 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: 25929@debbugs.gnu.org, Nicolas Petton , Stefan Monnier , Tino Calancha To: Michael Heerdegen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Mar 21 21:42:13 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1cqQba-0004BV-Ta for geb-bug-gnu-emacs@m.gmane.org; Tue, 21 Mar 2017 21:42:11 +0100 Original-Received: from localhost ([::1]:42358 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqQbg-0006Nk-Tx for geb-bug-gnu-emacs@m.gmane.org; Tue, 21 Mar 2017 16:42:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33003) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqQbW-0006NF-IY for bug-gnu-emacs@gnu.org; Tue, 21 Mar 2017 16:42:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqQbS-00029d-Iw for bug-gnu-emacs@gnu.org; Tue, 21 Mar 2017 16:42:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:40162) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cqQbS-00029Z-FO for bug-gnu-emacs@gnu.org; Tue, 21 Mar 2017 16:42:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cqQbS-0006Ne-8q for bug-gnu-emacs@gnu.org; Tue, 21 Mar 2017 16:42:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 21 Mar 2017 20:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25929 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 25929-submit@debbugs.gnu.org id=B25929.149012887124466 (code B ref 25929); Tue, 21 Mar 2017 20:42:02 +0000 Original-Received: (at 25929) by debbugs.gnu.org; 21 Mar 2017 20:41:11 +0000 Original-Received: from localhost ([127.0.0.1]:38361 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cqQad-0006MY-EI for submit@debbugs.gnu.org; Tue, 21 Mar 2017 16:41:11 -0400 Original-Received: from hermes.netfonds.no ([80.91.224.195]:60049) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cqQab-0006MP-Fi for 25929@debbugs.gnu.org; Tue, 21 Mar 2017 16:41:10 -0400 Original-Received: from cm-84.213.17.174.getinternet.no ([84.213.17.174] helo=stories) by hermes.netfonds.no with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1cqQaT-0007J5-GK; Tue, 21 Mar 2017 21:41:04 +0100 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAElBMVEUOCw0HBQYDAQIEAgNy dHItGCETLK1FAAACYUlEQVQ4jV2Uy5abMAyG5QnsrSHsM+Z0j1HZw4m9NyfW+79KfxkmndYJC/Tp Lhka5Mdh5sg84GESWZYlhLAI/tFobAoA4UsAhiVMzWiQbyBTgonORUtk4VPuDczpQyR12qWq/Q55 hoEBSTtLqvilVPdB7tkslgBX2XFN2ZjCotssRoBFzepqfqmuZXQSazGLIGOpSQveLFk/SFRnFpOo 9jkhJRpO4E8QRJPeau71sDz6lD2xgSUC9PUZs75EViRWThAefdJ73UvKT+YOIF/AzP09l7Qdzic7 AB4A7SCN+ah6cN8AsiWAED6nj0mGdeS/gBuAGP19jBJ76woadIEFDV4meYN0MDuCm08rYFkVabwB U3x93SAfZH3KQEUNbNb2+JrdS2aR+1Mc0RXeYx7IcuM7M4qnQqcvFEkTuVG5uqPup3ZuTybxPCfu j73b1dSz4kCFhN2a3P3I3QaQEVyLJQdwW9PR7em+9dA9I3fWsJsb015LGncaIdZEHrkRuuUwIwB/ kPVKMcp22AnRrXPJOXK+Q+zjArPMPPx2FdNwrDmrSUsDWMz1BoAOdVqs6h5smCNhl1CigTEX9r4B Lv14prlhuL5id5onQlVYk1wt0YzhFgMtDERHlwosYInVdKcnMr3xbB10bRC+eSJ1A5ufei3BWLer Drs46DIIBuedzzU3gBWPaqn4ilH7wtZ289XuqWdUMh64yN6i0DeQ87LbhbUwSK2BJf77CbjAJI8K r4tMYvc8vgF2U23OdGsWP8Gv1o/6/M9VCF+oldh/tE/GW25L3c701r+aeInDhC/BBZrJH3tAu4P6 wX9zAAAAAElFTkSuQmCC In-Reply-To: <87efydlxfh.fsf@drachen> (Michael Heerdegen's message of "Sat, 04 Mar 2017 01:04:18 +0100") 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: 208.118.235.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:130794 Archived-At: Michael Heerdegen writes: > Stefan Monnier writes: > >> > (macroexp-let2 nil key >> > `(progn >> > (map--dispatch ,map >> > :list (setf (alist-get ,key ,map nil t) nil) >> > :hash-table (remhash ,key ,map) >> > :array (and (>= ,key 0) >> > (<= ,key (seq-length ,map)) >> > (aset ,map ,key nil))) >> > ,map))) >> >> Note that this will make it pretty much impossible to use >> cl-generic dispatch. > > It will also break cases where MAP is an expression that is not a > symbol: > > #+begin_src emacs-lisp > (let ((thing (cons 'tag (list (cons 0 1) (cons 2 3))))) > (map-delete (cdr thing) 0)) > ==> nil > > (map-delete (list (cons 0 1) (cons 2 3)) 0) > ==> if: Symbol's function definition is void: \(setf\ list\) > #+end_src If MAP isn't a symbol, then map-delete could avoid doing the setf, couldn't it? I think that should make for a pretty useful form. You can both say ... (map-delete foo 'bar) ... and (setq foo (cons (map-delete (get-a-list) 'bar) 'zot)) and not be surprised at the results. It's certainly more fun than the current (setq foo (delete 'bar foo)) we have all over the place, even if it's something of a departure from how functions like this has traditionally worked in various Lisps. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no