GNU bug report logs - #25929
25.2; map-delete doesn't delete permanently 1st alist elt

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Tino Calancha <tino.calancha@HIDDEN>; dated Thu, 2 Mar 2017 07:19:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 25929 <at> debbugs.gnu.org:


Received: (at 25929) by debbugs.gnu.org; 26 Apr 2017 07:58:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 26 03:58:21 2017
Received: from localhost ([127.0.0.1]:40515 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1d3Hq8-0000R2-KB
	for submit <at> debbugs.gnu.org; Wed, 26 Apr 2017 03:58:21 -0400
Received: from petton.fr ([89.234.186.68]:34479)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <nicolas@HIDDEN>) id 1d3Hq7-0000Qp-Fj
 for 25929 <at> debbugs.gnu.org; Wed, 26 Apr 2017 03:58:20 -0400
From: Nicolas Petton <nicolas@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#25929: 25.2;
 map-delete doesn't delete permanently 1st alist elt
In-Reply-To: <jwvefxq8jc7.fsf-monnier+emacsbugs@HIDDEN>
References: <87k288p2oq.fsf@HIDDEN> <87k288kkqr.fsf@HIDDEN>
 <87efyfluvi.fsf@HIDDEN> <jwvbmtjwwdn.fsf-monnier+emacsbugs@HIDDEN>
 <87a88eq2uw.fsf@HIDDEN> <jwv37e6fyzi.fsf-monnier+emacsbugs@HIDDEN>
 <871stqpkqn.fsf@HIDDEN> <jwvefxq8jc7.fsf-monnier+emacsbugs@HIDDEN>
Date: Wed, 26 Apr 2017 09:58:10 +0200
Message-ID: <87vaprha7h.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha256; protocol="application/pgp-signature"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=petton.fr; s=mail;
 t=1493193492; bh=UjU81elNrJLI+WsBZDGFzUHWZ5DDjtCUjpblyK2lCA8=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID:MIME-Version:Content-Type;
 b=vVx0iYr3Lod6EXatBQTYOq2Kny9vsIsVzKY7AeTbfAn+NXMtIKIGUtNRTDL+HoRt0wd6gyOq87b379E37pqZIF4VAWE93bS0PnjYTgegYD5nb2B2YcOLGvfFb+Zfhpx1t9qbIFWhcKtcZH3DgUfptBEuA3luH1OP09inM5A1rwg=
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 25929
Cc: 25929 <at> debbugs.gnu.org, Tino Calancha <tino.calancha@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

--=-=-=
Content-Type: text/plain

Stefan Monnier <monnier@HIDDEN> writes:

> That's right.  Or it could signal an error, if copying is considered to
> be "never the right thing to do".

If hash-tables were persistent data structures, I'd say that it would
definitely be the right thing to do.

I didn't implement map.el as a functional library because vectors and
hash-tables are not persistent.

Nico

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJZAFMSAAoJECM1h6R8IHkQRtoIAIGDWRt2CEX8BIXi4ntLzA9s
KXXRviN55szDuyHKhv6xhkrHgA+Bs+4gs8+jx/YotADd5DXceV8LqLX+PVA1hPdz
NsSFKmPabhZ3ollgVHAEPmzoiDosa2cFl+WbaA+XYWiueZTKlE1ziTZQ5Jf/Oxav
nu9xNAvQ+3NEtwd1drk0A/5qvHIkJcOnHXyT+IK0Gi52Sj+8iJWdD3CGxzu+q+pX
sVcEgvoEz5jXCQ7ECFNriOw3gmExFVqy7cvaf7CqzyRqL/voc2UBBVQ4KwwxWbB/
X+OPlyZQwFH7zlqe5TIrfn5UFuI+y6CoYt2bo5xge4iKn5ozLO3Ny1VS0NFzk90=
=BEam
-----END PGP SIGNATURE-----
--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#25929; Package emacs. Full text available.

Message received at 25929 <at> debbugs.gnu.org:


Received: (at 25929) by debbugs.gnu.org; 29 Mar 2017 15:37:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 29 11:37:00 2017
Received: from localhost ([127.0.0.1]:51484 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ctFea-00062I-8D
	for submit <at> debbugs.gnu.org; Wed, 29 Mar 2017 11:37:00 -0400
Received: from petton.fr ([89.234.186.68]:38583)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <nicolas@HIDDEN>) id 1ctFeU-00061z-JA
 for 25929 <at> debbugs.gnu.org; Wed, 29 Mar 2017 11:36:54 -0400
From: Nicolas Petton <nicolas@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>,
 Michael Heerdegen <michael_heerdegen@HIDDEN>
Subject: Re: bug#25929: 25.2; plists and map-*
In-Reply-To: <m3inmsnlz9.fsf_-_@stories>
References: <87k288p2oq.fsf@HIDDEN> <87k288kkqr.fsf@HIDDEN>
 <87efyfluvi.fsf@HIDDEN> <jwvbmtjwwdn.fsf-monnier+emacsbugs@HIDDEN>
 <87efydlxfh.fsf@drachen> <m3lgrytlb6.fsf@stories> <878tnxa5l4.fsf@drachen>
 <m3inmsnlz9.fsf_-_@stories>
Date: Wed, 29 Mar 2017 17:36:41 +0200
Message-ID: <87shlwrt6e.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha256; protocol="application/pgp-signature"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=petton.fr; s=mail;
 t=1490801802; bh=QZXDfH4878qGb6B2a8Pro7pV3WLAdy54l+boS50YNGU=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID:MIME-Version:Content-Type;
 b=UoFENZAGeL2IjyDlfN/tFePniPnMt2UJwtvDuUCjWYiwOIdAInN/Y569m2lWwXj9K2uEWq0QD1nAqkf8jaFZzDJ/GX1MC+KplDiQ5iXB03VnjEkTlZnsrKcrKn6sWcKcZb0rEhIDwCpQJ+AGlWdVuKRWIcWzyKspHMUtJRU4JrQ=
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 25929
Cc: 25929 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>,
 Tino Calancha <tino.calancha@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

--=-=-=
Content-Type: text/plain

Lars Ingebrigtsen <larsi@HIDDEN> writes:

> A thing just occurred to me: Does the map-* functions work for plists,
> too?  plists are, like, the fourth major mapping structure we have in
> Lisp.

Not currently.

> Wouldn't it be easy to extend map-* to handle plists, too?  For
> instance, map-delete (of course) knows whether it's looking at a hash
> table or an array, but it can also easily distinguish between an alist
> and a plist by just looking at the first element, can't it?

Yes, it would, and was proposed a few weeks ago.

> It's a bit hacky, though.  But might be nice.

It would.  I didn't do it initially exactly because I thought it was a
bit hackish, but I agree that it would be nice to have.

Cheers,
Nico

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJY29SJAAoJECM1h6R8IHkQusMH/iir7t7LulWDdyWlUoLZtv7z
36CyZ23VTXpNMqh3dyklzCKQuam/c4nLlZCzUFur/otpSwkqSwRFQrsSPursPyPp
ntDhAHSIT/Z3vZ2bIt/AtSgGN+eExzAFw7AzhpWrMN0MRIMflLTBnkwUIh+JO1zN
y0ct+eQfyL6yMuEu17mhPRLNDyk30V6qM5C+sDx6g8Fb4Cf4pe/1BPrj7YA472C9
csOqM9OUZAvm3yqUFv9yZvL6Hzy73kqEB5fV1CHyAvPCKjLL3ZAN3ueKz7WznBHd
kit03AHIZOh4xGaf5W5CPa9FoBnD8oOs+QlEx1bb5Rb6dyeBKQ3ugl/d4ZD/6pc=
=wlwc
-----END PGP SIGNATURE-----
--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#25929; Package emacs. Full text available.

Message received at 25929 <at> debbugs.gnu.org:


Received: (at 25929) by debbugs.gnu.org; 29 Mar 2017 15:25:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 29 11:25:57 2017
Received: from localhost ([127.0.0.1]:51478 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ctFTx-0005mG-6k
	for submit <at> debbugs.gnu.org; Wed, 29 Mar 2017 11:25:57 -0400
Received: from hermes.netfonds.no ([80.91.224.195]:41191)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1ctFTv-0005m8-Mw
 for 25929 <at> debbugs.gnu.org; Wed, 29 Mar 2017 11:25:56 -0400
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 <larsi@HIDDEN>)
 id 1ctFTm-0000Pu-Qa; Wed, 29 Mar 2017 17:25:48 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Michael Heerdegen <michael_heerdegen@HIDDEN>
Subject: Re: bug#25929: 25.2; plists and map-*
References: <87k288p2oq.fsf@HIDDEN> <87k288kkqr.fsf@HIDDEN>
 <87efyfluvi.fsf@HIDDEN> <jwvbmtjwwdn.fsf-monnier+emacsbugs@HIDDEN>
 <87efydlxfh.fsf@drachen> <m3lgrytlb6.fsf@stories>
 <878tnxa5l4.fsf@drachen>
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEX96tf6xbb82MVeJSr8
 zbzRnJX1ua3++e1OenqcAAACbklEQVQ4jVWUTXPaMBCGNc5Qzpsq7tXZmJ7bOOZcqeucA2Y5RwTr
 zI2/33dlIKmGGQ/7eD9frd0+1ynlXBN55ja2ws7O2eWUvSdPEiKzq5gNLM8zEB8lwIGbiqviYYC8
 CNkveCnoApJIQPwQFOeANAUsz+5YAIVxRzWpZyQ/F5B8oJzpoxOqc73lEJ2rdgiFt+ucaOwk1Iky
 tyLNorsCmrruiIgyMMfo7tSAUE519wk4ukUBoc75A0AuQJpKf5RQOecRIBp4iKutc2NlAA7I0PXW
 fJiaJ3Wr72srl2aHNUCgTfyr7mlsLgD27gWjlSHFYXy/ey5DnCMBsPiwi+3rr8Xb+xewi2iaaxQ7
 dqqfoBdhCftF5ap+vRiXBpLlfgZoH3WFQenvb3o+AVjbABGDbRbVKvdv57OBRCW3QO7Ij9vVeIBM
 mDwUtFAvMbYRKm1/dr0JeMIQX0tRNtZWVodhrbw0F4p/DUBuFpFB+x27ArzMA4HagfzwkO8bU/bk
 ZM5tgLwfpDZgJ003IJSUfJztrojUbcT6UN2QuKr5AnLykV83ZA7lyp2uAKSdyG62c7G4FJUAchrg
 QALjfEtnoACKq2hgWZU1mAz0k+ajOYQ5TFFQrb+c1QPIdW1suuYCUG9QKmqe7UXBsaTwmqS97dMM
 IDKqHbzZ+eJgYBr7PVQJmAk26gvI2kPG2A6T7lWnz1D4n5P8aQc1oJ8ee2RAnY/TZGs4udMtFEqS
 e25rLDxzdQ2lNg1sOreTbhRhr6HU5hfRGRnAWS5nsLdQ9yG29FBvjofIs/2WA58GfFDifENuIJmZ
 TMXmf0DBFg5Pj84v4B9iUwo2+Yp4vQAAAABJRU5ErkJggg==
Date: Wed, 29 Mar 2017 17:25:46 +0200
In-Reply-To: <878tnxa5l4.fsf@drachen> (Michael Heerdegen's message of "Wed, 22
 Mar 2017 12:55:35 +0100")
Message-ID: <m3inmsnlz9.fsf_-_@stories>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 25929
Cc: 25929 <at> debbugs.gnu.org, Nicolas Petton <nicolas@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>,
 Tino Calancha <tino.calancha@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

A thing just occurred to me: Does the map-* functions work for plists,
too?  plists are, like, the fourth major mapping structure we have in
Lisp.

Wouldn't it be easy to extend map-* to handle plists, too?  For
instance, map-delete (of course) knows whether it's looking at a hash
table or an array, but it can also easily distinguish between an alist
and a plist by just looking at the first element, can't it?

It's a bit hacky, though.  But might be nice.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#25929; Package emacs. Full text available.

Message received at 25929 <at> debbugs.gnu.org:


Received: (at 25929) by debbugs.gnu.org; 22 Mar 2017 20:31:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 22 16:31:31 2017
Received: from localhost ([127.0.0.1]:39789 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cqmup-0002V1-Mf
	for submit <at> debbugs.gnu.org; Wed, 22 Mar 2017 16:31:31 -0400
Received: from pruche.dit.umontreal.ca ([132.204.246.22]:46688)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1cqmun-0002Ut-HQ
 for 25929 <at> debbugs.gnu.org; Wed, 22 Mar 2017 16:31:30 -0400
Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242])
 by pruche.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id v2MKVQYX027301;
 Wed, 22 Mar 2017 16:31:27 -0400
Received: by pastel.home (Postfix, from userid 20848)
 id 8026561AB9; Wed, 22 Mar 2017 16:31:26 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: Re: bug#25929: 25.2;
 map-delete doesn't delete permanently 1st alist elt
Message-ID: <jwvpoh93vgx.fsf-monnier+emacsbugs@HIDDEN>
References: <87k288p2oq.fsf@HIDDEN> <87k288kkqr.fsf@HIDDEN>
 <87efyfluvi.fsf@HIDDEN> <jwvbmtjwwdn.fsf-monnier+emacsbugs@HIDDEN>
 <87efydlxfh.fsf@drachen> <m3lgrytlb6.fsf@stories>
 <878tnxa5l4.fsf@drachen> <m3inn1jz9x.fsf@stories>
 <CAM-tV--RAbsW+ovxd8PtvXC8LoFoVY2f81CTkQW=T2qvhCbCPg@HIDDEN>
 <m38tnxjv4v.fsf@stories> <jwvd1d95jnu.fsf-monnier+emacsbugs@HIDDEN>
 <m3poh9ql8o.fsf@stories>
Date: Wed, 22 Mar 2017 16:31:26 -0400
In-Reply-To: <m3poh9ql8o.fsf@stories> (Lars Ingebrigtsen's message of "Wed, 22
 Mar 2017 18:23:03 +0100")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-NAI-Spam-Flag: NO
X-NAI-Spam-Threshold: 5
X-NAI-Spam-Score: 0
X-NAI-Spam-Rules: 2 Rules triggered
	EDT_SA_DN_PASS=0, RV5979=0
X-NAI-Spam-Version: 2.3.0.9418 : core <5979> : inlines <5754> : streams
 <1738088> : uri <2396882>
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: 25929
Cc: Michael Heerdegen <michael_heerdegen@HIDDEN>, 25929 <at> debbugs.gnu.org,
 Nicolas Petton <nicolas@HIDDEN>, Tino Calancha <tino.calancha@HIDDEN>,
 Noam Postavsky <npostavs@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.3 (-)

>> The problem is how to make it extensible to user-defined types
>> via something like cl-generic.el (e.g. add support for avl-tree.el
>> without having to make map.el aware of avl-tree.el).

> Hm...  I haven't used cl-generic.el, but having map-delete be something
> like this work?

> (defmacro map-delete (map elem)
>   (if (symbolp map)
>       `(setq ,map (map-delete-1 ,map ,elem))
>     `(map-delete-1 ,map ,elem)))

It would work, yes.  I think the resulting semantics is pretty ugly, but
it's just a question of taste.


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#25929; Package emacs. Full text available.

Message received at 25929 <at> debbugs.gnu.org:


Received: (at 25929) by debbugs.gnu.org; 22 Mar 2017 17:23:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 22 13:23:14 2017
Received: from localhost ([127.0.0.1]:39694 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cqjyb-0006Wl-TC
	for submit <at> debbugs.gnu.org; Wed, 22 Mar 2017 13:23:14 -0400
Received: from hermes.netfonds.no ([80.91.224.195]:52319)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1cqjya-0006Wc-Dj
 for 25929 <at> debbugs.gnu.org; Wed, 22 Mar 2017 13:23:12 -0400
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 <larsi@HIDDEN>)
 id 1cqjyR-0005fo-Cn; Wed, 22 Mar 2017 18:23:05 +0100
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#25929: 25.2;
 map-delete doesn't delete permanently 1st alist elt
References: <87k288p2oq.fsf@HIDDEN> <87k288kkqr.fsf@HIDDEN>
 <87efyfluvi.fsf@HIDDEN> <jwvbmtjwwdn.fsf-monnier+emacsbugs@HIDDEN>
 <87efydlxfh.fsf@drachen> <m3lgrytlb6.fsf@stories>
 <878tnxa5l4.fsf@drachen> <m3inn1jz9x.fsf@stories>
 <CAM-tV--RAbsW+ovxd8PtvXC8LoFoVY2f81CTkQW=T2qvhCbCPg@HIDDEN>
 <m38tnxjv4v.fsf@stories> <jwvd1d95jnu.fsf-monnier+emacsbugs@HIDDEN>
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAADFBMVEVlRzFZNyNCJBaDb1+r
 l/OYAAACZklEQVQokR3J7U8SAQDH8d/BwfRycZBnyFrLB5ialUgPW7N4umPJartjHAHrhTpgQi9K
 /4HUSZubm+iEhq/ACQvWi3rXyzMsV5nU2loPa1m+aL0Kc65WVxf1fffZF0BVrfxPfgB66DJkd6UO
 yQ/Wz7FOkrbbpD4Coxcowkqj80PfQyeSTj9opqkqEUwKTkbQI+0Ykkk9iSARbH4xpfTW3KQaX9l2
 w94NSV2tjXXhjoHhnl+p6ey/5RTOzT5qjNb22QY0Di3U7PjQrQ17cq0t6kWFlfl+rKuZSJrAIZXA
 Vyc3rZ3aQgOqs5caHbrdH1Rr2oBtvlNcqW3/ehU2A7sm+nTC3dHxxhICJDIUTRzpUo2FUhNQDs6M
 Fg1Hm6iMSGJvMcv1TB24SBXSPKQvKl90UrVmEj0puF9vBbXssc1ydCGC3NVe5zVF+RPPrgSwq6wS
 dey0FpeW8XMjSevqZySbXsL5GZhO1NEdM5Ug3+dV/464kA9A0rX55hTlyW29R8QpR56drowXS/EA
 i29GSW8UhPlit0VEP7vqD9D5pNAdyEC2cYLR4BwsipkMqroczwgd3nKiNAj7U7M/QpuHs2mvB/i+
 TpIMy4U5vwnE3F1xosU3n0hmyqAWNA7K1e73ZJkWyNZmkjGd0Q+LKxnUTlqJj2wDFbFko7C940Ik
 Kg8K4lIMgxvXef/hZ6646FvGZ8Xsah7Q7M9ESzm8rMasVKqPzecKU8BjAzutySdz8bATtrPv+aAx
 Hg+3JPpxvOkTSVNUMTza40LOUaIc2nw2liBvYuTeDseaE96QuPgWgdqW4Gkr92TiIctfYMPqo9Yw
 +ZUAAAAASUVORK5CYII=
Date: Wed, 22 Mar 2017 18:23:03 +0100
In-Reply-To: <jwvd1d95jnu.fsf-monnier+emacsbugs@HIDDEN> (Stefan Monnier's
 message of "Wed, 22 Mar 2017 13:04:32 -0400")
Message-ID: <m3poh9ql8o.fsf@stories>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 25929
Cc: Michael Heerdegen <michael_heerdegen@HIDDEN>, 25929 <at> debbugs.gnu.org,
 Nicolas Petton <nicolas@HIDDEN>, Tino Calancha <tino.calancha@HIDDEN>,
 Noam Postavsky <npostavs@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

Stefan Monnier <monnier@HIDDEN> writes:

> The problem is how to make it extensible to user-defined types
> via something like cl-generic.el (e.g. add support for avl-tree.el
> without having to make map.el aware of avl-tree.el).

Hm...  I haven't used cl-generic.el, but having map-delete be something
like this work?

(defmacro map-delete (map elem)
  (if (symbolp map)
      `(setq ,map (map-delete-1 ,map ,elem))
    `(map-delete-1 ,map ,elem)))

And then having map-delete-1 be the thing to support user-defined types?

It'd be kinda an even more unusual Lisp construct, but, on the other
hand, I don't think Lisp has ever come up with an elegant way to express
these mutating functions before, so we're free to innovate.  :-)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#25929; Package emacs. Full text available.

Message received at 25929 <at> debbugs.gnu.org:


Received: (at 25929) by debbugs.gnu.org; 22 Mar 2017 17:04:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 22 13:04:35 2017
Received: from localhost ([127.0.0.1]:39662 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cqjgZ-000657-Hi
	for submit <at> debbugs.gnu.org; Wed, 22 Mar 2017 13:04:35 -0400
Received: from chene.dit.umontreal.ca ([132.204.246.20]:54244)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1cqjgX-00064z-Pw
 for 25929 <at> debbugs.gnu.org; Wed, 22 Mar 2017 13:04:34 -0400
Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242])
 by chene.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id v2MH4XJY031784;
 Wed, 22 Mar 2017 13:04:33 -0400
Received: by pastel.home (Postfix, from userid 20848)
 id E9C1C60680; Wed, 22 Mar 2017 13:04:32 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: Re: bug#25929: 25.2;
 map-delete doesn't delete permanently 1st alist elt
Message-ID: <jwvd1d95jnu.fsf-monnier+emacsbugs@HIDDEN>
References: <87k288p2oq.fsf@HIDDEN> <87k288kkqr.fsf@HIDDEN>
 <87efyfluvi.fsf@HIDDEN> <jwvbmtjwwdn.fsf-monnier+emacsbugs@HIDDEN>
 <87efydlxfh.fsf@drachen> <m3lgrytlb6.fsf@stories>
 <878tnxa5l4.fsf@drachen> <m3inn1jz9x.fsf@stories>
 <CAM-tV--RAbsW+ovxd8PtvXC8LoFoVY2f81CTkQW=T2qvhCbCPg@HIDDEN>
 <m38tnxjv4v.fsf@stories>
Date: Wed, 22 Mar 2017 13:04:32 -0400
In-Reply-To: <m38tnxjv4v.fsf@stories> (Lars Ingebrigtsen's message of "Wed, 22
 Mar 2017 14:31:12 +0100")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-NAI-Spam-Flag: NO
X-NAI-Spam-Level: 
X-NAI-Spam-Threshold: 5
X-NAI-Spam-Score: 0.1
X-NAI-Spam-Rules: 3 Rules triggered
 GEN_SPAM_FEATRE=0.1, EDT_SA_DN_PASS=0, RV5979=0
X-NAI-Spam-Version: 2.3.0.9418 : core <5979> : inlines <5754> : streams
 <1738068> : uri <2396802>
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: 25929
Cc: Michael Heerdegen <michael_heerdegen@HIDDEN>, 25929 <at> debbugs.gnu.org,
 Nicolas Petton <nicolas@HIDDEN>, Tino Calancha <tino.calancha@HIDDEN>,
 Noam Postavsky <npostavs@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.3 (-)

> I'm not quite sure what the objection to map-delete being a macro is...

The problem is how to make it extensible to user-defined types
via something like cl-generic.el (e.g. add support for avl-tree.el
without having to make map.el aware of avl-tree.el).


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#25929; Package emacs. Full text available.

Message received at 25929 <at> debbugs.gnu.org:


Received: (at 25929) by debbugs.gnu.org; 22 Mar 2017 17:02:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 22 13:02:45 2017
Received: from localhost ([127.0.0.1]:39658 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cqjen-000620-4n
	for submit <at> debbugs.gnu.org; Wed, 22 Mar 2017 13:02:45 -0400
Received: from pruche.dit.umontreal.ca ([132.204.246.22]:57104)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1cqjej-00061p-Rd
 for 25929 <at> debbugs.gnu.org; Wed, 22 Mar 2017 13:02:43 -0400
Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242])
 by pruche.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id v2MH2dcs003809;
 Wed, 22 Mar 2017 13:02:40 -0400
Received: by pastel.home (Postfix, from userid 20848)
 id 671A160680; Wed, 22 Mar 2017 13:02:39 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: Re: bug#25929: 25.2;
 map-delete doesn't delete permanently 1st alist elt
Message-ID: <jwvinn15jpt.fsf-monnier+emacsbugs@HIDDEN>
References: <87k288p2oq.fsf@HIDDEN> <87k288kkqr.fsf@HIDDEN>
 <87efyfluvi.fsf@HIDDEN> <jwvbmtjwwdn.fsf-monnier+emacsbugs@HIDDEN>
 <87efydlxfh.fsf@drachen> <m3lgrytlb6.fsf@stories>
 <878tnxa5l4.fsf@drachen> <m3inn1jz9x.fsf@stories>
Date: Wed, 22 Mar 2017 13:02:39 -0400
In-Reply-To: <m3inn1jz9x.fsf@stories> (Lars Ingebrigtsen's message of "Wed, 22
 Mar 2017 13:01:46 +0100")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-NAI-Spam-Flag: NO
X-NAI-Spam-Threshold: 5
X-NAI-Spam-Score: 0
X-NAI-Spam-Rules: 2 Rules triggered
	EDT_SA_DN_PASS=0, RV5979=0
X-NAI-Spam-Version: 2.3.0.9418 : core <5979> : inlines <5754> : streams
 <1738068> : uri <2396802>
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: 25929
Cc: Michael Heerdegen <michael_heerdegen@HIDDEN>, 25929 <at> debbugs.gnu.org,
 Nicolas Petton <nicolas@HIDDEN>, Tino Calancha <tino.calancha@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.3 (-)

> Making map-delete signal an error in the
> alist-where-bar-is-the-first-element sounds even worse to me, since the
> user may already be writing this stuff as (setq foo (map-delete foo
> 'bar)).
> (I think this was what Stefan suggested...)

Good catch, no, what I'm suggesting is to signal an error when
map-delete is called on an alist (forcing the user to use map-remove
for that instead).


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#25929; Package emacs. Full text available.

Message received at 25929 <at> debbugs.gnu.org:


Received: (at 25929) by debbugs.gnu.org; 22 Mar 2017 14:43:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 22 10:43:48 2017
Received: from localhost ([127.0.0.1]:39556 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cqhUG-0002hs-0Z
	for submit <at> debbugs.gnu.org; Wed, 22 Mar 2017 10:43:48 -0400
Received: from mout.web.de ([217.72.192.78]:62580)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1cqhU9-0002hW-Nl
 for 25929 <at> debbugs.gnu.org; Wed, 22 Mar 2017 10:43:41 -0400
Received: from drachen.dragon ([92.208.182.212]) by smtp.web.de (mrweb101
 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MgfJz-1cVbor2kmF-00NvkA; Wed, 22
 Mar 2017 15:43:06 +0100
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: Re: bug#25929: 25.2;
 map-delete doesn't delete permanently 1st alist elt
References: <87k288p2oq.fsf@HIDDEN> <87k288kkqr.fsf@HIDDEN>
 <87efyfluvi.fsf@HIDDEN> <jwvbmtjwwdn.fsf-monnier+emacsbugs@HIDDEN>
 <87efydlxfh.fsf@drachen> <m3lgrytlb6.fsf@stories>
 <878tnxa5l4.fsf@drachen> <m3inn1jz9x.fsf@stories>
 <CAM-tV--RAbsW+ovxd8PtvXC8LoFoVY2f81CTkQW=T2qvhCbCPg@HIDDEN>
 <m38tnxjv4v.fsf@stories>
Date: Wed, 22 Mar 2017 15:43:09 +0100
In-Reply-To: <m38tnxjv4v.fsf@stories> (Lars Ingebrigtsen's message of "Wed, 22
 Mar 2017 14:31:12 +0100")
Message-ID: <87mvcdxthe.fsf@drachen>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K0:upgt4mq6+u+ob3IiDwldv+gxh3xsIqJEXNmx+cRauaVg81wU8d7
 twf+xM4sDSLUE7L2WAcbVxR3KClaXJ9zovPPBfcURHcw/UUkkP2whkLm76ci4qBgcnGQq+1
 7ZE1F/uzPplHBAWvTU5otH4WtNfRNIzB4Tqv1/ff3m1tuT7esJhRDg7n+DzZVi4MYsXbTup
 6I8K08snX6imB7ZC5WzYg==
X-UI-Out-Filterresults: notjunk:1;V01:K0:Skq9/2sPGx0=:ObCClwiEclJoy/Wda8DhsU
 b1tgU38HwV1NYFy8s2Vh2zrXPYPfhBJ6mm3ICb+asDGk3P+EpAwpYFRUX6wghLfMOWHK2RC02
 EKuXK+Mth8EGZtoSXUjKVO3B+tGGgFh0YMQNcer1eHnLb/vGIMPZicJ9Vbhh3ruaHB1OwAO/z
 pz3nyJIyk3Py76IAxyJJCGqARYxk8Sv59YtYK2hbWLVNULvU9GtUrzfXjNdsaEf/EAR1w8RhB
 hY1otZVHqeMnJDRQLZNVkYzlItI78il8aWHRIeOx4LzwKZKk9xmmEJGecGcTUf34UqNs18YR9
 w88BsUosNYEhKmK3RqeQlteO5f9xgNiew62GCGRLBln+9eWdmy753QEiaQEpYjpTzIMCZLaCx
 SpSLBKaeKp4JYjli699Xk3H1zGNYIXm2f3vRwRt1igz5/6HxsGLRZL02Kr/TUDD0aYgEh3PUW
 XoGUUuCdBmCFQ+AYd1sj9YSDAorzfORS/+NaSZ65ablmKG/0rf+RHLduTDrVcJx3HNq8YRaAw
 fhhaZQ5MUHiJGOMOaCliSk7HNDOI8r7CFGssopgdNshIwJRgPrvHW64A6BsvrBItL5r9U2W0K
 ecqIp92+gNv0WShr0GYNjS0nFv9+PIi0Gtf0AOKvVgfADtVFpHlPutSvXLpwyu6j23AShfcNR
 Wwl47Z2jdDlN0I+zjWM3gyUOc6aDc3LWm5zMesSqAw5HWSTUQuY4cmtmZxDR+5oykKWWYIWEo
 ZQKIEJ7eL8zrUE6GJZWB3NIkXkFNqaH/0XRwl+RbCGv4lWp32+0waJroIM6+kFM7ENYuxBpeE
 4L1gWlg
X-Spam-Score: -3.5 (---)
X-Debbugs-Envelope-To: 25929
Cc: 25929 <at> debbugs.gnu.org, Nicolas Petton <nicolas@HIDDEN>,
 Tino Calancha <tino.calancha@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>,
 Noam Postavsky <npostavs@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.5 (---)

Lars Ingebrigtsen <larsi@HIDDEN> writes:

> I'm not quite sure what the objection to map-delete being a macro
> is...

It depends on what you find "convenient".  For any macro, I have to
remember which arguments are evaluated and which not, or read the docs
every time I want to use it.  Macros make debugging harder.  Etc.
That's why we usually avoid macros when a function would do.

I understand that you find your suggestion more convenient, but OTOH it
would not be consistent with similar functions we have and introduce
another inconsistency.  I just think it's not worth it.


Michael.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#25929; Package emacs. Full text available.

Message received at 25929 <at> debbugs.gnu.org:


Received: (at 25929) by debbugs.gnu.org; 22 Mar 2017 13:31:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 22 09:31:40 2017
Received: from localhost ([127.0.0.1]:38795 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cqgMW-0007Vg-4d
	for submit <at> debbugs.gnu.org; Wed, 22 Mar 2017 09:31:40 -0400
Received: from hermes.netfonds.no ([80.91.224.195]:56068)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1cqgMT-0007VV-Je
 for 25929 <at> debbugs.gnu.org; Wed, 22 Mar 2017 09:31:38 -0400
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 <larsi@HIDDEN>)
 id 1cqgM4-0000Tn-CX; Wed, 22 Mar 2017 14:31:28 +0100
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Noam Postavsky <npostavs@HIDDEN>
Subject: Re: bug#25929: 25.2;
 map-delete doesn't delete permanently 1st alist elt
References: <87k288p2oq.fsf@HIDDEN> <87k288kkqr.fsf@HIDDEN>
 <87efyfluvi.fsf@HIDDEN> <jwvbmtjwwdn.fsf-monnier+emacsbugs@HIDDEN>
 <87efydlxfh.fsf@drachen> <m3lgrytlb6.fsf@stories>
 <878tnxa5l4.fsf@drachen> <m3inn1jz9x.fsf@stories>
 <CAM-tV--RAbsW+ovxd8PtvXC8LoFoVY2f81CTkQW=T2qvhCbCPg@HIDDEN>
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAElBMVEVHQUFlXlwSEBGxqaUr
 KCg5NTWwNAYgAAACeElEQVQ4jX2TQY8zJwyGTRbuuIT7Lp29h2/UOxnZd0+K//9f6custlpVbYkS
 gR/br20I7f++Ov0H2P8H9H9YyjfgH6byt30nLj+8895L/6HRv2F97n1lACRsGOsL/Pq976VchErp
 3LlwWWHs5bF3+BcmBgXBwnnbrkDYmArSwGelLv0Ya3O5EXPgVcmVuX3sOCx7Jqacv7V3fuv7Y4GS
 KTslxJSl1P25kpa9B6ZHSiWgxrwqOD7wG8qeuVJG9BtaQdPc2ztDDMXnSumEcWXtjz23917K0h6R
 ql2lgeUO8CgcQmCDsobsjAISAXGGLJ1MB9Fgd8I6mifmFEIyIjnIkCR6rtzau3N2M1c1AGjXRBA6
 2gaQzKLoHAeFO4DRn73qKVz9dBVPiHirqK+juSrW3qOIi0xXRFCngFpQyGiNEir0OcfEroeQMcxw
 vKCf4EmUKBIpO+oL1Y5ba58JZgx8AWJL1+doWLDiLtwnUrCR4zwvkC1TkrmhD1zUajzJ64rwCPMm
 rwUSeUguc4GUECmCPhCQ58hThWD/iNI2uAAkkCmGxvICN8XO1V4AIag+ZQt3ALRuajrniiBWyyK3
 XwskhZgsEENksbjp/GOlwjBUFCq4KAqGwWmMrb0WgP1+NDI7TUaU+5I4PkZS+fTVkOmoI6xp4zSf
 Rojwhs7pnJPyOEfcWrNsJKrS0DlCpmZJ21ggOKnPly7gShjyow30fMqzqqMOj4R55yokc4i08TrZ
 YQh8ww0q1Vw/Ua9tesMd8/pGinhuyeYnhFTsN+KvdafheC2pYbj5Jekevv5P4U4q26ZySApVNNVw
 +VPpJO3AhTUZlqNebx92gL8AeVOzm8XarqMAAAAASUVORK5CYII=
Date: Wed, 22 Mar 2017 14:31:12 +0100
In-Reply-To: <CAM-tV--RAbsW+ovxd8PtvXC8LoFoVY2f81CTkQW=T2qvhCbCPg@HIDDEN>
 (Noam Postavsky's message of "Wed, 22 Mar 2017 08:56:18 -0400")
Message-ID: <m38tnxjv4v.fsf@stories>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 25929
Cc: Michael Heerdegen <michael_heerdegen@HIDDEN>, 25929 <at> debbugs.gnu.org,
 Nicolas Petton <nicolas@HIDDEN>, Stefan Monnier <monnier@HIDDEN>,
 Tino Calancha <tino.calancha@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

Noam Postavsky <npostavs@HIDDEN> writes:

> It's also fine to say (setq foo (map-delete foo 'bar)) if foo is hash
> table, right?

Sure, but then this isn't a very convenient form to use at all.
Everybody who uses hash tables will use the old form, which makes this
generalisation useless in practice.

I'm not quite sure what the objection to map-delete being a macro is...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#25929; Package emacs. Full text available.

Message received at 25929 <at> debbugs.gnu.org:


Received: (at 25929) by debbugs.gnu.org; 22 Mar 2017 12:56:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 22 08:56:34 2017
Received: from localhost ([127.0.0.1]:38767 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cqfoU-0006ch-IN
	for submit <at> debbugs.gnu.org; Wed, 22 Mar 2017 08:56:34 -0400
Received: from mail-ot0-f170.google.com ([74.125.82.170]:33929)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <npostavs@HIDDEN>) id 1cqfoO-0006cQ-Ja
 for 25929 <at> debbugs.gnu.org; Wed, 22 Mar 2017 08:56:28 -0400
Received: by mail-ot0-f170.google.com with SMTP id o24so168639569otb.1
 for <25929 <at> debbugs.gnu.org>; Wed, 22 Mar 2017 05:56:24 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:sender:in-reply-to:references:from:date:message-id
 :subject:to:cc;
 bh=kJZLlwSHAZbMNjK64aa5GWRJWaN/+EkZi279ifYHJOI=;
 b=dLzm38AwPS/6VnZnewozkwRyRnJCQ3Itmsh7tZkEMcu4tzefkuh8idAQ6fzbI17rJy
 e5mtR0YPA6bZtlN5jB1ALtHEAWJFl2nlw2V8LSgwUuPbXgJGiCPQxlOr76M8EiWBzT65
 QKXhRTQ2YJ6linrcnobcc6cvvjTiyMuvw2RdPPNBypSAaulvQZ95C2ziffFABlNmF0MV
 c2/kqp4Ij58EY0Q8W5Op6cgzXCivNf7L1eHoqyoGwgBYXbp3k93ToKUZ3bi4ZNwD2ui4
 NAj4Fm0l+m8mzKUk2cbBXIfzRmaPx4B0M5Qc48p6mLJCmujOaZ17UNtOtT3Z9r6p/HNX
 DsIg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:sender:in-reply-to:references:from
 :date:message-id:subject:to:cc;
 bh=kJZLlwSHAZbMNjK64aa5GWRJWaN/+EkZi279ifYHJOI=;
 b=OoJG/r6SAOmHV/Pln6S3D7D0TYnKRVSKTF9pvZK11UT0aE38kemE/hs9V6TGNuxIes
 79uxwgPJDfWG1DoSQDUy0EB4mhixQ3jqNs1YVMxgjj/n/bL9YppDYABWNwQq98hIq8af
 fSDJe+EyLL0EU/OkvSTxZQFyLObkGFHUo2RdZBKS8++28d1AKMD/s8VZOczxRX4hEJHj
 OZ+2ZonxesHCa4m0er57imNr+JULfyHCIKRjTWzvZshPOwaAHHwhrEIwhJa6Sw19fi0J
 Sh2v0euJo0s805hVxvo6SEpTjyCE5o+tktAG5bmP0XjoMzGpjEB7rnb3oImpN6yXyQLM
 XL5Q==
X-Gm-Message-State: AFeK/H38wWqDpF5ABEorTFYSwO+Nu1Vldp43cum7uiLZsf/XNiUn9ExCSTjIZi6XMJca+NKKpd7MRBSJ49WIOA==
X-Received: by 10.157.68.173 with SMTP id v45mr3303663ote.55.1490187378974;
 Wed, 22 Mar 2017 05:56:18 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.157.80.172 with HTTP; Wed, 22 Mar 2017 05:56:18 -0700 (PDT)
In-Reply-To: <m3inn1jz9x.fsf@stories>
References: <87k288p2oq.fsf@HIDDEN> <87k288kkqr.fsf@HIDDEN>
 <87efyfluvi.fsf@HIDDEN> <jwvbmtjwwdn.fsf-monnier+emacsbugs@HIDDEN>
 <87efydlxfh.fsf@drachen> <m3lgrytlb6.fsf@stories> <878tnxa5l4.fsf@drachen>
 <m3inn1jz9x.fsf@stories>
From: Noam Postavsky <npostavs@HIDDEN>
Date: Wed, 22 Mar 2017 08:56:18 -0400
X-Google-Sender-Auth: nR1N_t-WcReG8QJp3Jp4TFBnurg
Message-ID: <CAM-tV--RAbsW+ovxd8PtvXC8LoFoVY2f81CTkQW=T2qvhCbCPg@HIDDEN>
Subject: Re: bug#25929: 25.2;
 map-delete doesn't delete permanently 1st alist elt
To: Lars Ingebrigtsen <larsi@HIDDEN>
Content-Type: text/plain; charset=UTF-8
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: 25929
Cc: Michael Heerdegen <michael_heerdegen@HIDDEN>, 25929 <at> debbugs.gnu.org,
 Nicolas Petton <nicolas@HIDDEN>, Stefan Monnier <monnier@HIDDEN>,
 Tino Calancha <tino.calancha@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.7 (/)

On Wed, Mar 22, 2017 at 8:01 AM, Lars Ingebrigtsen <larsi@HIDDEN> wrote:
> Michael Heerdegen <michael_heerdegen@HIDDEN> writes:
>
>> That's a relatively small gain, and some people might prefer the
>> explicit form (2) for readability.
>
> If we don't do this, (map-delete foo 'bar) has surprising effects in
> this one corner case.
>
> That is, if foo is a hash table, then it's fine to say
> (map-delete foo 'bar).  If you change foo to be an alist, you then have
> to transform all the calls to be (setq foo (map-delete foo 'bar))
> instead,

It's also fine to say (setq foo (map-delete foo 'bar)) if foo is hash
table, right?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#25929; Package emacs. Full text available.

Message received at 25929 <at> debbugs.gnu.org:


Received: (at 25929) by debbugs.gnu.org; 22 Mar 2017 12:02:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 22 08:02:25 2017
Received: from localhost ([127.0.0.1]:38727 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cqey9-0005Kg-B2
	for submit <at> debbugs.gnu.org; Wed, 22 Mar 2017 08:02:25 -0400
Received: from hermes.netfonds.no ([80.91.224.195]:51847)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1cqey7-0005KY-Su
 for 25929 <at> debbugs.gnu.org; Wed, 22 Mar 2017 08:02:24 -0400
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 <larsi@HIDDEN>)
 id 1cqexW-0001VZ-Ll; Wed, 22 Mar 2017 13:02:07 +0100
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Michael Heerdegen <michael_heerdegen@HIDDEN>
Subject: Re: bug#25929: 25.2;
 map-delete doesn't delete permanently 1st alist elt
References: <87k288p2oq.fsf@HIDDEN> <87k288kkqr.fsf@HIDDEN>
 <87efyfluvi.fsf@HIDDEN> <jwvbmtjwwdn.fsf-monnier+emacsbugs@HIDDEN>
 <87efydlxfh.fsf@drachen> <m3lgrytlb6.fsf@stories>
 <878tnxa5l4.fsf@drachen>
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAElBMVEVHQUFlXlwSEBGxqaUr
 KCg5NTWwNAYgAAACeElEQVQ4jX2TQY8zJwyGTRbuuIT7Lp29h2/UOxnZd0+K//9f6custlpVbYkS
 gR/br20I7f++Ov0H2P8H9H9YyjfgH6byt30nLj+8895L/6HRv2F97n1lACRsGOsL/Pq976VchErp
 3LlwWWHs5bF3+BcmBgXBwnnbrkDYmArSwGelLv0Ya3O5EXPgVcmVuX3sOCx7Jqacv7V3fuv7Y4GS
 KTslxJSl1P25kpa9B6ZHSiWgxrwqOD7wG8qeuVJG9BtaQdPc2ztDDMXnSumEcWXtjz23917K0h6R
 ql2lgeUO8CgcQmCDsobsjAISAXGGLJ1MB9Fgd8I6mifmFEIyIjnIkCR6rtzau3N2M1c1AGjXRBA6
 2gaQzKLoHAeFO4DRn73qKVz9dBVPiHirqK+juSrW3qOIi0xXRFCngFpQyGiNEir0OcfEroeQMcxw
 vKCf4EmUKBIpO+oL1Y5ba58JZgx8AWJL1+doWLDiLtwnUrCR4zwvkC1TkrmhD1zUajzJ64rwCPMm
 rwUSeUguc4GUECmCPhCQ58hThWD/iNI2uAAkkCmGxvICN8XO1V4AIag+ZQt3ALRuajrniiBWyyK3
 XwskhZgsEENksbjp/GOlwjBUFCq4KAqGwWmMrb0WgP1+NDI7TUaU+5I4PkZS+fTVkOmoI6xp4zSf
 Rojwhs7pnJPyOEfcWrNsJKrS0DlCpmZJ21ggOKnPly7gShjyow30fMqzqqMOj4R55yokc4i08TrZ
 YQh8ww0q1Vw/Ua9tesMd8/pGinhuyeYnhFTsN+KvdafheC2pYbj5Jekevv5P4U4q26ZySApVNNVw
 +VPpJO3AhTUZlqNebx92gL8AeVOzm8XarqMAAAAASUVORK5CYII=
Date: Wed, 22 Mar 2017 13:01:46 +0100
In-Reply-To: <878tnxa5l4.fsf@drachen> (Michael Heerdegen's message of "Wed, 22
 Mar 2017 12:55:35 +0100")
Message-ID: <m3inn1jz9x.fsf@stories>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 25929
Cc: 25929 <at> debbugs.gnu.org, Nicolas Petton <nicolas@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>,
 Tino Calancha <tino.calancha@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

Michael Heerdegen <michael_heerdegen@HIDDEN> writes:

> That's a relatively small gain, and some people might prefer the
> explicit form (2) for readability.

If we don't do this, (map-delete foo 'bar) has surprising effects in
this one corner case.

That is, if foo is a hash table, then it's fine to say
(map-delete foo 'bar).  If you change foo to be an alist, you then have
to transform all the calls to be (setq foo (map-delete foo 'bar))
instead, which kind of breaks the abstraction that map-delete tried to
offer, I think?

Making map-delete signal an error in the
alist-where-bar-is-the-first-element sounds even worse to me, since the
user may already be writing this stuff as (setq foo (map-delete foo
'bar)).

(I think this was what Stefan suggested...)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#25929; Package emacs. Full text available.

Message received at 25929 <at> debbugs.gnu.org:


Received: (at 25929) by debbugs.gnu.org; 22 Mar 2017 11:56:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 22 07:56:04 2017
Received: from localhost ([127.0.0.1]:38712 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cqerv-000597-Cb
	for submit <at> debbugs.gnu.org; Wed, 22 Mar 2017 07:56:03 -0400
Received: from mout.web.de ([212.227.15.3]:57691)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1cqero-00058l-Mm
 for 25929 <at> debbugs.gnu.org; Wed, 22 Mar 2017 07:55:57 -0400
Received: from drachen.dragon ([92.208.182.212]) by smtp.web.de (mrweb004
 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MBY4U-1czxz63WFS-00AUqy; Wed, 22
 Mar 2017 12:55:34 +0100
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: Re: bug#25929: 25.2;
 map-delete doesn't delete permanently 1st alist elt
References: <87k288p2oq.fsf@HIDDEN> <87k288kkqr.fsf@HIDDEN>
 <87efyfluvi.fsf@HIDDEN> <jwvbmtjwwdn.fsf-monnier+emacsbugs@HIDDEN>
 <87efydlxfh.fsf@drachen> <m3lgrytlb6.fsf@stories>
Date: Wed, 22 Mar 2017 12:55:35 +0100
In-Reply-To: <m3lgrytlb6.fsf@stories> (Lars Ingebrigtsen's message of "Tue, 21
 Mar 2017 21:41:01 +0100")
Message-ID: <878tnxa5l4.fsf@drachen>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K0:Cc+9M+2m7a+Blb3G/F6I7O4a+U7HNCSrVoeawiHJxIGYILlsMJB
 ahLZLWNLWJ0yqkLOUiGMNuiKiprOn/UsVnX+5X78od6L9Bt3AuPqDYmOXY1aDEmZgnc8Ihj
 Bgkg5GRICFvmgzJFWbYsi1e3j7mZ7g4Yc7s/dTIu096feoX5lMCHbYNnNvC0vlrEAhbRpnq
 rvu5lwbojQgZbPv07JC9g==
X-UI-Out-Filterresults: notjunk:1;V01:K0:rRNdOHnlTdM=:gZTR4sPUhWOTnoNpfVSLcj
 jQ5zG22UPoWbu9d23ekQFk/L1jEnMtWIC3hkyAmBu3v0/ayZv4fT2l39LqHgr/7/wqaHAz7Kz
 aPo5kPkndR4xMR20aw3Ksl7Xte9g48ZOf8JaqWobAzzzluIhhcw8EhM63avwJylgZ5fdQV701
 l7U/KrIIlAFcPs5y+/a5iqcxQUMDMhShlf93v+QUsekEJe0cFn6yFMFOQOR520lkQJLKkW4VF
 3IRGbBIimSrG8gbqkjMuC3X1AnDdV7zwFXuEWLaYr6WeNoEAuB3QxrE0LS25TfbpphrlA7k/2
 oACBqKoA4OuXxL2AXe5RxIYjqoetG5jO4qKewGfk6kbFWfg10I4S9XcURWr2EZvkUsAXAY4Al
 Ndk2nUkC0bKQWEzfvOvT1Y9XhI+q7BnqC+2VBBHWAR6LFuWIZLIgoN5sMg+z3QsGLToDSJ5Ng
 R2qxr5aaSyEqasuwWKMk7w6+3N2Q0/PLR8HCVrnreITPUhtU92SYlcwCJHOba7aP2KevSSpBB
 0VJ5LF3DrheoyIE5t+NhcFAuRCPpWfTne/gv2YQGEGY99L2hnxSWgqsyem0xtAQ4T3UsIE9S4
 lIRBJj1++utygs3hoRHATGd6kLPLz/sj9wp1+VVs9TX0nu++8gHf6BiKRlXqkoe7y3OpsbCqi
 E2TMYbQt0+SBRyh2sr/cRevN7B4wC5HzWUJhHKdIG44ldy3rIdZYsujFb6mirEnn/U4XnePMf
 cFjSU48RiVOXJGeKY74FL+/0rBVK7Umaj7vl0K1KcfI6Dau4ZOoEyh03d4lEm9fWq8D1uzY1H
 geBKPnh
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 25929
Cc: 25929 <at> debbugs.gnu.org, Nicolas Petton <nicolas@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>,
 Tino Calancha <tino.calancha@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

Lars Ingebrigtsen <larsi@HIDDEN> writes:

> 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.

So your suggestion is, with other words, that

(1)  (map-delete EXPR 'bar)

is implicitly transformed into

(2)  (cl-callf map-delete EXPR 'bar)

when EXPR is a valid place expression.

That's a relatively small gain, and some people might prefer the
explicit form (2) for readability.

OTOH, without such magic, we can avoid making `map-delete' a macro.
Personally I prefer this simpler approach.


Regards,

Michael.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#25929; Package emacs. Full text available.

Message received at 25929 <at> debbugs.gnu.org:


Received: (at 25929) by debbugs.gnu.org; 21 Mar 2017 20:41:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 21 16:41:11 2017
Received: from localhost ([127.0.0.1]:38361 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cqQad-0006MY-EI
	for submit <at> debbugs.gnu.org; Tue, 21 Mar 2017 16:41:11 -0400
Received: from hermes.netfonds.no ([80.91.224.195]:60049)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1cqQab-0006MP-Fi
 for 25929 <at> debbugs.gnu.org; Tue, 21 Mar 2017 16:41:10 -0400
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 <larsi@HIDDEN>)
 id 1cqQaT-0007J5-GK; Tue, 21 Mar 2017 21:41:04 +0100
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Michael Heerdegen <michael_heerdegen@HIDDEN>
Subject: Re: bug#25929: 25.2;
 map-delete doesn't delete permanently 1st alist elt
References: <87k288p2oq.fsf@HIDDEN> <87k288kkqr.fsf@HIDDEN>
 <87efyfluvi.fsf@HIDDEN> <jwvbmtjwwdn.fsf-monnier+emacsbugs@HIDDEN>
 <87efydlxfh.fsf@drachen>
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
Date: Tue, 21 Mar 2017 21:41:01 +0100
In-Reply-To: <87efydlxfh.fsf@drachen> (Michael Heerdegen's message of "Sat, 04
 Mar 2017 01:04:18 +0100")
Message-ID: <m3lgrytlb6.fsf@stories>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 25929
Cc: 25929 <at> debbugs.gnu.org, Nicolas Petton <nicolas@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>,
 Tino Calancha <tino.calancha@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

Michael Heerdegen <michael_heerdegen@HIDDEN> writes:

> Stefan Monnier <monnier@HIDDEN> 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




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#25929; Package emacs. Full text available.

Message received at 25929 <at> debbugs.gnu.org:


Received: (at 25929) by debbugs.gnu.org; 21 Mar 2017 20:29:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 21 16:29:50 2017
Received: from localhost ([127.0.0.1]:38357 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cqQPe-00065c-AY
	for submit <at> debbugs.gnu.org; Tue, 21 Mar 2017 16:29:50 -0400
Received: from chene.dit.umontreal.ca ([132.204.246.20]:40062)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1cqQPb-00065S-7u
 for 25929 <at> debbugs.gnu.org; Tue, 21 Mar 2017 16:29:48 -0400
Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242])
 by chene.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id v2LKTktA002232;
 Tue, 21 Mar 2017 16:29:46 -0400
Received: by pastel.home (Postfix, from userid 20848)
 id 22E9A61DCC; Tue, 21 Mar 2017 16:29:46 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Nicolas Petton <nicolas@HIDDEN>
Subject: Re: bug#25929: 25.2;
 map-delete doesn't delete permanently 1st alist elt
Message-ID: <jwvefxq8jc7.fsf-monnier+emacsbugs@HIDDEN>
References: <87k288p2oq.fsf@HIDDEN> <87k288kkqr.fsf@HIDDEN>
 <87efyfluvi.fsf@HIDDEN> <jwvbmtjwwdn.fsf-monnier+emacsbugs@HIDDEN>
 <87a88eq2uw.fsf@HIDDEN> <jwv37e6fyzi.fsf-monnier+emacsbugs@HIDDEN>
 <871stqpkqn.fsf@HIDDEN>
Date: Tue, 21 Mar 2017 16:29:46 -0400
In-Reply-To: <871stqpkqn.fsf@HIDDEN> (Nicolas Petton's message of "Tue, 21
 Mar 2017 19:06:56 +0100")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-NAI-Spam-Flag: NO
X-NAI-Spam-Threshold: 5
X-NAI-Spam-Score: 0
X-NAI-Spam-Rules: 2 Rules triggered
	EDT_SA_DN_PASS=0, RV5978=0
X-NAI-Spam-Version: 2.3.0.9418 : core <5978> : inlines <5752> : streams
 <1737948> : uri <2396328>
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: 25929
Cc: 25929 <at> debbugs.gnu.org, Tino Calancha <tino.calancha@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.3 (-)

>> I was thinking of providing map-remove additionally to map-delete (and
>> make map-delete signal an error when it can't do its job).  IOW declare
>> that some parts of the API can't be used with all types.
> Yes, that's what I want as well, but then `map-remove' would be
> functional (return another map), and it means that it would copy
> hash-tables.

That's right.  Or it could signal an error, if copying is considered to
be "never the right thing to do".


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#25929; Package emacs. Full text available.

Message received at 25929 <at> debbugs.gnu.org:


Received: (at 25929) by debbugs.gnu.org; 21 Mar 2017 18:07:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 21 14:07:11 2017
Received: from localhost ([127.0.0.1]:38235 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cqOBb-0002LJ-2V
	for submit <at> debbugs.gnu.org; Tue, 21 Mar 2017 14:07:11 -0400
Received: from petton.fr ([89.234.186.68]:58504)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <nicolas@HIDDEN>) id 1cqOBX-0002Kj-ML
 for 25929 <at> debbugs.gnu.org; Tue, 21 Mar 2017 14:07:08 -0400
From: Nicolas Petton <nicolas@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#25929: 25.2;
 map-delete doesn't delete permanently 1st alist elt
In-Reply-To: <jwv37e6fyzi.fsf-monnier+emacsbugs@HIDDEN>
References: <87k288p2oq.fsf@HIDDEN> <87k288kkqr.fsf@HIDDEN>
 <87efyfluvi.fsf@HIDDEN> <jwvbmtjwwdn.fsf-monnier+emacsbugs@HIDDEN>
 <87a88eq2uw.fsf@HIDDEN> <jwv37e6fyzi.fsf-monnier+emacsbugs@HIDDEN>
Date: Tue, 21 Mar 2017 19:06:56 +0100
Message-ID: <871stqpkqn.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha256; protocol="application/pgp-signature"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=petton.fr; s=mail;
 t=1490119619; bh=0aIRbb/4ynKlww2ZaSZAJ4MzqoPsuxCj2P/vbZtneWE=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID:MIME-Version:Content-Type;
 b=dVxdsJv266JFt4gMbcAFnffgTTLQQ4M4x1/GtviazA/J1lW89O9d87xKOwtTxwOJ2WN2uW1s6EMbLdzszdpLgvWbEWYiKtOQbSQuUYqaqasr4d7oOFyrLUZMb0DdcRrZir/huNC8+oY2lhWDaFHRC/eH9UepugtD/eFF0Tmx/t8=
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 25929
Cc: 25929 <at> debbugs.gnu.org, Tino Calancha <tino.calancha@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

--=-=-=
Content-Type: text/plain

Stefan Monnier <monnier@HIDDEN> writes:

> I was thinking of providing map-remove additionally to map-delete (and
> make map-delete signal an error when it can't do its job).  IOW declare
> that some parts of the API can't be used with all types.

Yes, that's what I want as well, but then `map-remove' would be
functional (return another map), and it means that it would copy
hash-tables.

Cheers,
Nico

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJY0WvAAAoJECM1h6R8IHkQ9UkH/3C108iO3FgOiqwrqnDEe6ar
paWBY6n1BhlzBqINM4FmViLSmEiMrU8TD4I33qZYvDXrVMQxpkRqL3EmoTlBtffE
kTdmJHUFsFZgQS5ELTbRjQDDM+UWU8XeAcYvHwAWRbEn4j1VJ9NdoGGdBK7giXEu
Vp164Oa7y511QyaqQyoa6gxXRirglR6Z8Wd5uWe+UN7GGod3XbvlawqygdYQrTzr
Yg4UtGGqaX6IFyPsdqEAq8yHLPGTckSh0DSs98oeSmSVj/+89aQ91VKu5SO/4SCy
xuybc+TFN//2ak3tDhsbRYcv1fP8LF0SrX22euSy2GHWabUxjKC1XT1B6rVOeV4=
=VEBx
-----END PGP SIGNATURE-----
--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#25929; Package emacs. Full text available.

Message received at 25929 <at> debbugs.gnu.org:


Received: (at 25929) by debbugs.gnu.org; 21 Mar 2017 15:11:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 21 11:11:23 2017
Received: from localhost ([127.0.0.1]:38097 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cqLRT-0006Y8-G6
	for submit <at> debbugs.gnu.org; Tue, 21 Mar 2017 11:11:23 -0400
Received: from pruche.dit.umontreal.ca ([132.204.246.22]:37490)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1cqLRS-0006Y0-E9
 for 25929 <at> debbugs.gnu.org; Tue, 21 Mar 2017 11:11:22 -0400
Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242])
 by pruche.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id v2LFBKts024799;
 Tue, 21 Mar 2017 11:11:21 -0400
Received: by pastel.home (Postfix, from userid 20848)
 id 9AFAB602FE; Tue, 21 Mar 2017 11:11:20 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Nicolas Petton <nicolas@HIDDEN>
Subject: Re: bug#25929: 25.2;
 map-delete doesn't delete permanently 1st alist elt
Message-ID: <jwv37e6fyzi.fsf-monnier+emacsbugs@HIDDEN>
References: <87k288p2oq.fsf@HIDDEN> <87k288kkqr.fsf@HIDDEN>
 <87efyfluvi.fsf@HIDDEN> <jwvbmtjwwdn.fsf-monnier+emacsbugs@HIDDEN>
 <87a88eq2uw.fsf@HIDDEN>
Date: Tue, 21 Mar 2017 11:11:20 -0400
In-Reply-To: <87a88eq2uw.fsf@HIDDEN> (Nicolas Petton's message of "Tue, 21
 Mar 2017 12:35:35 +0100")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-NAI-Spam-Flag: NO
X-NAI-Spam-Threshold: 5
X-NAI-Spam-Score: 0
X-NAI-Spam-Rules: 2 Rules triggered
	EDT_SA_DN_PASS=0, RV5978=0
X-NAI-Spam-Version: 2.3.0.9418 : core <5978> : inlines <5751> : streams
 <1737917> : uri <2396199>
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: 25929
Cc: 25929 <at> debbugs.gnu.org, Tino Calancha <tino.calancha@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.3 (-)

>> A better option might be to provide a map-remove which works
>> functionally (i.e. doesn't modify its argument by side-effects)
> I'd love to have that, but what about performance issues with
> hash-tables?

I was thinking of providing map-remove additionally to map-delete (and
make map-delete signal an error when it can't do its job).  IOW declare
that some parts of the API can't be used with all types.


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#25929; Package emacs. Full text available.

Message received at 25929 <at> debbugs.gnu.org:


Received: (at 25929) by debbugs.gnu.org; 21 Mar 2017 11:35:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 21 07:35:46 2017
Received: from localhost ([127.0.0.1]:37265 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cqI4o-0001Hu-Ep
	for submit <at> debbugs.gnu.org; Tue, 21 Mar 2017 07:35:46 -0400
Received: from petton.fr ([89.234.186.68]:52140)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <nicolas@HIDDEN>) id 1cqI4m-0001Hf-PT
 for 25929 <at> debbugs.gnu.org; Tue, 21 Mar 2017 07:35:45 -0400
From: Nicolas Petton <nicolas@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#25929: 25.2;
 map-delete doesn't delete permanently 1st alist elt
In-Reply-To: <jwvbmtjwwdn.fsf-monnier+emacsbugs@HIDDEN>
References: <87k288p2oq.fsf@HIDDEN> <87k288kkqr.fsf@HIDDEN>
 <87efyfluvi.fsf@HIDDEN> <jwvbmtjwwdn.fsf-monnier+emacsbugs@HIDDEN>
Date: Tue, 21 Mar 2017 12:35:35 +0100
Message-ID: <87a88eq2uw.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha256; protocol="application/pgp-signature"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=petton.fr; s=mail;
 t=1490096138; bh=aPbPrxl/nt86S6cBrargqIwlOpl2fHEM8FU+ylAUTHU=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID:MIME-Version:Content-Type;
 b=ZBvDCTrqXRkRtZkUIoieQDosJIFD68PK49dn9LB8hyI2atW5fWkw5/Q3aNiMc24u9XIfM8ucNVNmf68oD6uGqZ/QPw0vceQ9yMKlAYjF3ZAXjU7hoOp096cTdzm766GmRlEAWOzFM0iWtXzIo/pLl+O7V/YgLb03Ou5Ou/wFPt4=
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 25929
Cc: 25929 <at> debbugs.gnu.org, Tino Calancha <tino.calancha@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

--=-=-=
Content-Type: text/plain

Stefan Monnier <monnier@HIDDEN> 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.

Indeed, but I already have that issue.  To use `cl-generic', map.el has
to be basically rewritten from scratch.

> A better option might be to provide a map-remove which works
> functionally (i.e. doesn't modify its argument by side-effects)

I'd love to have that, but what about performance issues with
hash-tables?

hash-tables aren't persistent collections, and having `map-remove',
`map-add', etc. work functionally, the hash-table would have
to be copied for each operation.

Cheers,
Nico

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJY0RAHAAoJECM1h6R8IHkQHDoH/3JBMEp6F3/8U4l4TNuw51h+
PPkjeaqesgxaqpw0GDmuhKEeBenFqmqE0LQk48G3XiiANnfv2kyKVpgtRwJf4t/E
g9W66B5KXOp8OR8Gxvu6filrUAeb7aETHNnjuHuy5pNhYe+vGtfmfUxeT7kPbaj9
CSd2NnFt4kQicpvaE4aRuFY4fYOaAEiH1niN/yNDUBAWWUxkhxoCjnw/7e3z8djR
V2Zs+A5jJs3IyAhEAiioabHyLPV9CuPgXxd2+hbpwweI9qyllYlkAfIbJyYjAS9H
iAl7m+A7wpnhdiPYRZiFlCfXnpRnROA0XPpAm+gAxuQScEHvddfCbK1fbcFCt9o=
=8QwG
-----END PGP SIGNATURE-----
--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#25929; Package emacs. Full text available.

Message received at 25929 <at> debbugs.gnu.org:


Received: (at 25929) by debbugs.gnu.org; 4 Mar 2017 00:17:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 03 19:17:05 2017
Received: from localhost ([127.0.0.1]:38946 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cjxNh-0007B6-1f
	for submit <at> debbugs.gnu.org; Fri, 03 Mar 2017 19:17:05 -0500
Received: from mout.web.de ([212.227.15.4]:62908)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1cjxNe-0007AZ-KN
 for 25929 <at> debbugs.gnu.org; Fri, 03 Mar 2017 19:17:03 -0500
Received: from drachen.dragon ([109.44.2.231]) by smtp.web.de (mrweb002
 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MK2FR-1clKI3193l-001TyY; Sat, 04
 Mar 2017 01:16:50 +0100
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#25929: 25.2;
 map-delete doesn't delete permanently 1st alist elt
References: <87k288p2oq.fsf@HIDDEN> <87k288kkqr.fsf@HIDDEN>
 <87efyfluvi.fsf@HIDDEN> <jwvbmtjwwdn.fsf-monnier+emacsbugs@HIDDEN>
 <87efydlxfh.fsf@drachen>
Date: Sat, 04 Mar 2017 01:16:46 +0100
In-Reply-To: <87efydlxfh.fsf@drachen> (Michael Heerdegen's message of "Sat, 04
 Mar 2017 01:04:18 +0100")
Message-ID: <87a891lwup.fsf@drachen>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K0:zFo2eD8JFhXoI28Z+P6v8ZT1kB5f5WTP6kYnbyQ4EHmmwQgje1B
 oZFI2Vsma75uj625OjYEJA7dZptUn/NOwWJS0e0zSxsM4N2YfLesWNgTzQT5v4OVMvled+9
 Pe8B/PZ7CzxhaG4D9cjSMELrAFbTot1HFUr2k36tiK5Hz+Toq9s//TiVJRARXXDvbQj3Doc
 elW6Jxn/VpYFlp1UH1o2w==
X-UI-Out-Filterresults: notjunk:1;V01:K0:yVK4YJBKbao=:rS9nXbrITsIbtMH8FxpWc1
 piAVgDcC6dEnKpIqWuqpIyHY4hihLPVEbv9MnEBQezGZ0B1SpiZSa/vtpw3o9R5Za6VpKkBq/
 kJQhCJbcjpxUI7yF6QRBCZRDlQzWjk9j63UWAOlofTnGSO0HVpHMkZRBY822iIwlGzojQIUSu
 uDoKBkySUlbElRZx8Ti++jolBqI3ua9fLz31q/rWOvVZQt4O3gH4y19pKOvXNEO9QfVgXMmcd
 A6v3rACDsePa9PQyUh6zRhgZbVb1XVsvzpysCHqusZV52WSIU6E4ptoU/TXwFIFMqHrjby0E0
 eZodVBdtiOmx3raxokxzgrVfodpavty/uGOVnlljuuKhupsabYA1Xey0vs0CBJy+ZUSBGRQDX
 USht9ok2QbUP8Smsdmf4sses7m+gPkbcUHiYQl8MHFUGeyDh4zhPCNwnhhBzmTKEsj9lKvC0U
 iMPcSKhrtHdWmQAQXyUrybLOToVx+7AFbFX5ldccyeAA5KRQFXo04UJ33P0uNnZx6NO+YOq2Z
 wuaatEqfq7yuwNm+iwKqQelMzivfqkHLCnbJ6RFzpEgMDXxI3ccFuTPIPlbvQ8E1/cTvV4E0g
 Byd7+rXUUBZtx4FxN9DSMJth1Zi8R+HupDD9s+SbfGiMz3Gm0yCRraupL+a8CBKWjKdFh1t7h
 nYbHPPE2Tglk3NRzthB/N9frwbu9PhL1OXjiwyQMCf5sDGlrN8+ciTaS6DpgScwwenWXY570o
 tRIkFedF/iQHN38BnQ7afhYj5qs9HWhA/RE18/a9UPqcQ0CbVlBU7vdiHp9Ov1Bk7pGe7uYXI
 swD8sjK
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 25929
Cc: 25929 <at> debbugs.gnu.org, Nicolas Petton <nicolas@HIDDEN>,
 Tino Calancha <tino.calancha@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

Michael Heerdegen <michael_heerdegen@HIDDEN> writes:

> With other words, I would fix this issue by altering the docstring
> ("return the result" instead of "return MAP")

When the MAP is an alist with only one entry, the return value will be
something different than MAP anyway (a cons cannot be altered to become
nil) - unless we look at "MAP" as a place expression and rewrite the
thing accordingly.  I don't think that is necessary.


Michael.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#25929; Package emacs. Full text available.

Message received at 25929 <at> debbugs.gnu.org:


Received: (at 25929) by debbugs.gnu.org; 4 Mar 2017 00:04:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 03 19:04:45 2017
Received: from localhost ([127.0.0.1]:38938 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cjxBl-0006tB-MK
	for submit <at> debbugs.gnu.org; Fri, 03 Mar 2017 19:04:45 -0500
Received: from mout.web.de ([212.227.15.4]:58993)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1cjxBj-0006sx-HY
 for 25929 <at> debbugs.gnu.org; Fri, 03 Mar 2017 19:04:44 -0500
Received: from drachen.dragon ([109.44.2.231]) by smtp.web.de (mrweb003
 [213.165.67.108]) with ESMTPSA (Nemesis) id 0LyUha-1cFxeF26vW-015qP5; Sat, 04
 Mar 2017 01:04:21 +0100
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#25929: 25.2;
 map-delete doesn't delete permanently 1st alist elt
References: <87k288p2oq.fsf@HIDDEN> <87k288kkqr.fsf@HIDDEN>
 <87efyfluvi.fsf@HIDDEN> <jwvbmtjwwdn.fsf-monnier+emacsbugs@HIDDEN>
Date: Sat, 04 Mar 2017 01:04:18 +0100
In-Reply-To: <jwvbmtjwwdn.fsf-monnier+emacsbugs@HIDDEN> (Stefan Monnier's
 message of "Thu, 02 Mar 2017 10:12:09 -0500")
Message-ID: <87efydlxfh.fsf@drachen>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K0:kXpsWLzA/KUlUKKzrq7zcvP0BDv2RtPSvgQ4IyuWgENQu4cpft6
 Yx91hJas1e0ZhoCOY74N3OablZ/eHgt3qqQlzxKOclAKOsrEMB8qEu3YqV+DImT6Vw6URcz
 +wQtuCNLNGu+SwtRgI0FR1QCasZrD0t7m2dF2Wfhz5XjQtAahpHBOrVvzQ+o9avR4QNna+b
 7A+hLuNg0oHy9qAqAhAJQ==
X-UI-Out-Filterresults: notjunk:1;V01:K0:peQE5ynBOR0=:vUhrC3SLC3y+zOHbeiDxhE
 1hgp3smdRtAO7sMMocLLGHQSUfiUqie82knhIjaYTo4DyVYfqJBK71f89906AA4+ciuVXzget
 seFDPs+VNgztk82ZSFDZ21yajaN4ZkvWevby7sI+6s2n0HB5LVoPA47gSZLRuYk3SQEkCZRcN
 Wv41ypIN+rX7DzYRkvmvMPHkzz86Y+IomYd8rI8lSdSRfwCw7EtcWEZhwL02/6+YpH88TCEux
 JigfJ96kxUJuIetmsdrMs7LCVUdgsXLQaGFiWcNhLtlT6j5awHPSjUggeiFfFbOamLDTBwSiY
 k5IDDM2qfP9t682WTBHbqxogn+DndwgHlBvijdwOtlmdakxzjJ1O9Bk5DFyxsNXaylhiE4DLs
 ZcYOiv5S896XI96C7IlRrA68r+g2rkC8vkboj1/4LsU10DqFCqnQj1w7u73agm9dP5XwFnsn/
 MKcRJgBebobYJ+MsdYu51UEKAcKCJUJrpbZDwDYPoceSAIFoiIdtkn7rTOHRFnk7V0Qb6Wajg
 v5C1w7iiwfJ1T4IUHJ0WG1WjEJNE0ln2HKjZpJa4WgM0UgbReucVbY3orSkfi0aZghPxacVwA
 iTXdKPK8b5+YyIVuvBkfU1yV1vwsQC+2JcgbjCg8OVkjlxpxp0da1iN/vlDAHHsvNV2GbZPfe
 YELnSkh+a/c8XleURPtmPPFH+SEjoDKJlJAHPSoZ8ZudcIoL1M57CjfyyI2l+dYG9qChxznqc
 pv9Y2UVHedyUjDX6S5tEz+bKpsc9j1PdEkpU8C3s1/mt07cYPbXB4RP0oKJXvZjL20zrnJMPU
 SYA9Gjt
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 25929
Cc: 25929 <at> debbugs.gnu.org, Nicolas Petton <nicolas@HIDDEN>,
 Tino Calancha <tino.calancha@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

Stefan Monnier <monnier@HIDDEN> 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

> A better option might be to provide a map-remove which works
> functionally (i.e. doesn't modify its argument by side-effects), and
> then change map-delete to signal an error when we ask to delete the
> first element of the list (and to stop returning the "new map" since
> it just works imperatively instead).

Why not make it just like `delete': return the map with the entry
removed, the original map might be altered - that's it.

If you want to assign the result back to a symbol/place, use setf or
callf.  Any unnecessary magic just blows up the semantics.

With other words, I would fix this issue by altering the docstring
("return the result" instead of "return MAP") - or am I missing
something?


Michael.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#25929; Package emacs. Full text available.

Message received at 25929 <at> debbugs.gnu.org:


Received: (at 25929) by debbugs.gnu.org; 2 Mar 2017 15:12:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 02 10:12:19 2017
Received: from localhost ([127.0.0.1]:36704 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cjSOx-0006Rl-6q
	for submit <at> debbugs.gnu.org; Thu, 02 Mar 2017 10:12:19 -0500
Received: from ironport2-out.teksavvy.com ([206.248.154.181]:47481)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1cjSOu-0006RW-PV
 for 25929 <at> debbugs.gnu.org; Thu, 02 Mar 2017 10:12:18 -0500
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: A0AsBAAtNbhY/zPujBheGwEBAQMBAQEJAQEBg1CEeYVWhQJzkR0BlQuCDRqGAgQCAoJHQBgBAgEBAQEBAQFiKIRxBlYjEAs0EhQYDSSKDbQCixUBAQEHAgElizuKOQWQVItVlBWIXIZgkzcfOIEBIRQILD6ETh6BfyKKMwEBAQ
X-IPAS-Result: A0AsBAAtNbhY/zPujBheGwEBAQMBAQEJAQEBg1CEeYVWhQJzkR0BlQuCDRqGAgQCAoJHQBgBAgEBAQEBAQFiKIRxBlYjEAs0EhQYDSSKDbQCixUBAQEHAgElizuKOQWQVItVlBWIXIZgkzcfOIEBIRQILD6ETh6BfyKKMwEBAQ
X-IronPort-AV: E=Sophos;i="5.35,231,1484024400"; d="scan'208";a="294273723"
Received: from 24-140-238-51.cpe.teksavvy.com (HELO pastel.home)
 ([24.140.238.51])
 by smtp.teksavvy.com with ESMTP; 02 Mar 2017 10:12:10 -0500
Received: by pastel.home (Postfix, from userid 20848)
 id E687F654DD; Thu,  2 Mar 2017 10:12:09 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Nicolas Petton <nicolas@HIDDEN>
Subject: Re: bug#25929: 25.2;
 map-delete doesn't delete permanently 1st alist elt
Message-ID: <jwvbmtjwwdn.fsf-monnier+emacsbugs@HIDDEN>
References: <87k288p2oq.fsf@HIDDEN> <87k288kkqr.fsf@HIDDEN>
 <87efyfluvi.fsf@HIDDEN>
Date: Thu, 02 Mar 2017 10:12:09 -0500
In-Reply-To: <87efyfluvi.fsf@HIDDEN> (Nicolas Petton's message of "Thu, 02
 Mar 2017 13:34:57 +0100")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 25929
Cc: 25929 <at> debbugs.gnu.org, Tino Calancha <tino.calancha@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.3 (/)

>     (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.

A better option might be to provide a map-remove which works
functionally (i.e. doesn't modify its argument by side-effects), and
then change map-delete to signal an error when we ask to delete the
first element of the list (and to stop returning the "new map" since it
just works imperatively instead).


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#25929; Package emacs. Full text available.

Message received at 25929 <at> debbugs.gnu.org:


Received: (at 25929) by debbugs.gnu.org; 2 Mar 2017 13:34:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 02 08:34:42 2017
Received: from localhost ([127.0.0.1]:35483 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cjQsU-0003jD-7n
	for submit <at> debbugs.gnu.org; Thu, 02 Mar 2017 08:34:42 -0500
Received: from mail-pg0-f67.google.com ([74.125.83.67]:35029)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <tino.calancha@HIDDEN>) id 1cjQsS-0003j0-GI
 for 25929 <at> debbugs.gnu.org; Thu, 02 Mar 2017 08:34:40 -0500
Received: by mail-pg0-f67.google.com with SMTP id 1so9375120pgz.2
 for <25929 <at> debbugs.gnu.org>; Thu, 02 Mar 2017 05:34:40 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:date:to:cc:subject:in-reply-to:message-id:references
 :user-agent:mime-version;
 bh=32HsnIYvQo36j+Cri1J4rdEu7TKUWwxpoG9n62Ea6hs=;
 b=A5CQBLOa2bcrtxDiWUc5GhuD2ab+bULO51BlLBx3r1xZjvZTCmGNZa18CktzDMh5gt
 bHlVwI5ZRPMzyYUNltmyWQxq41LzQ1hEbmkDj6OisUzgZ66thFSaAZlxlo8h3t2eHb3D
 hNylsTglb/tvlGuv0jQ8kgogSd5Rpf8XA7d+P0O9BP2RAXUirMKOu57zYpTQNOeCAp38
 +3SNcmjyRGl2B+bFLYfe5pVyuyl4o72NBNIW843IxBLtE94jaeOm6t6HtEjPEXTPGMk5
 GYi0Lcx18nikf8K2PK00Z3uUs4Lz9tdr3eiv+PjYGpfEHZCPCcRrAHt8iEJ2+KadUJVj
 vwOA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id
 :references:user-agent:mime-version;
 bh=32HsnIYvQo36j+Cri1J4rdEu7TKUWwxpoG9n62Ea6hs=;
 b=FR78Cv8NH9gkJzmBG/606ffHf7Gfgui4chIf/UYBL1BOQfyB0mL9EaRfkFYM/PI18P
 Pk8cHtTLg143YvBIRop5RXOFVuhE5ThMXlSK7MLQCpuv714Xa4HJ3Yh0A8w8Xr3WTuCL
 6p8sGRoy6+S2kBLW11DLmOGWpi1JDaIaUWJ4MLd0QZfQ1x/JH6QvEBsq6MiPrgl8Ajxy
 tGQ+m6sXtcbLVqFEt6er8XO1PYthycGqKB+YuTissc8XK7XDAqS63ThVZf5DP56ub0g2
 lpzUhBie4w3S7zKwDFbmEhCzKPUSrRzVSvtKIYQCaVBJRCJX2ZQWoRV9px3Yh+EatuBZ
 xcxw==
X-Gm-Message-State: AMke39mwuZSlSMP5TU+f80rOLZX4qxcI7k5cLHl/5sdqnq34JXCI0BuqsSksrLF4/MKDMw==
X-Received: by 10.99.66.197 with SMTP id p188mr2449695pga.107.1488461674648;
 Thu, 02 Mar 2017 05:34:34 -0800 (PST)
Received: from calancha-pc (104.81.147.124.dy.bbexcite.jp. [124.147.81.104])
 by smtp.gmail.com with ESMTPSA id p4sm17385316pgd.50.2017.03.02.05.34.32
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Thu, 02 Mar 2017 05:34:33 -0800 (PST)
From: Tino Calancha <tino.calancha@HIDDEN>
X-Google-Original-From: Tino Calancha <calancha@HIDDEN>
Date: Thu, 2 Mar 2017 22:34:29 +0900 (JST)
X-X-Sender: calancha@calancha-pc
To: Nicolas Petton <nicolas@HIDDEN>
Subject: Re: bug#25929: 25.2; map-delete doesn't delete permanently 1st alist
 elt
In-Reply-To: <87efyfluvi.fsf@HIDDEN>
Message-ID: <alpine.DEB.2.20.1703022218480.30755@calancha-pc>
References: <87k288p2oq.fsf@HIDDEN> <87k288kkqr.fsf@HIDDEN>
 <87efyfluvi.fsf@HIDDEN>
User-Agent: Alpine 2.20 (DEB 67 2015-01-07)
MIME-Version: 1.0
Content-Type: text/plain; format=flowed; charset=US-ASCII
X-Spam-Score: 0.5 (/)
X-Debbugs-Envelope-To: 25929
Cc: 25929 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>,
 Tino Calancha <tino.calancha@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.5 (/)



On Thu, 2 Mar 2017, Nicolas Petton wrote:

> Nicolas Petton <nicolas@HIDDEN> writes:
>
>> The alist is indeed modified within the `map-delete' function, but in an
>> unexpected way: if the first key is deleted, the variable `map' is
>> `setq'ed, which has no effect outside of the function.
>>
>> One fix would be to make `map-delete' a macro:
>
> Here's a fixed version:
>
>  (defmacro map-delete (map key)
>    "Delete KEY from MAP and return MAP.
>  No error is signaled if KEY is not a key of MAP.  If MAP is an
>  array, store nil at the index KEY.
>
>  MAP can be a list, hash-table or array."
>    (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)))
>
> And the associated regression test:
>
>  (ert-deftest test-map-delete-first-key-alist ()
>    (let ((alist '((a . 1) (b . 2) (c . 3))))
>      (map-delete alist 'a)
>      (should (null (map-elt alist 'a)))))

Sorry, i don't understand why following doesn't work after the patch:
;; I have byte-compiled map.el after applying the patch.
emacs -Q

(let ((alist '((a . 1) (b . 2) (c . 3))))
   (map-delete alist 'a)
   (map-elt alist 'a))

Debugger entered--Lisp error: (void-function map--dispatch)

We shouldn't ask the user to compile the file on each interactive session
in order to `map--dispatch' be defined.

We might also mention in the doc strings that MAP must be a generalized
variable or something.
To explain that I) below is allowed but II) is not:
I)
  (assq-delete-all 'foo '((foo . 1) (bar . 2)))

II)
  (map-delete '((foo . 1) (bar . 2)) 'foo)


Regards,
Tino




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#25929; Package emacs. Full text available.

Message received at 25929 <at> debbugs.gnu.org:


Received: (at 25929) by debbugs.gnu.org; 2 Mar 2017 12:46:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 02 07:46:07 2017
Received: from localhost ([127.0.0.1]:35450 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cjQ7T-0002bQ-KJ
	for submit <at> debbugs.gnu.org; Thu, 02 Mar 2017 07:46:07 -0500
Received: from petton.fr ([89.234.186.68]:60555)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <nicolas@HIDDEN>) id 1cjQ7S-0002aq-I5
 for 25929 <at> debbugs.gnu.org; Thu, 02 Mar 2017 07:46:06 -0500
From: Nicolas Petton <nicolas@HIDDEN>
To: npostavs@HIDDEN
Subject: Re: bug#25929: 25.2;
 map-delete doesn't delete permanently 1st alist elt
In-Reply-To: <87lgsnc0th.fsf@HIDDEN>
References: <87k288p2oq.fsf@HIDDEN> <87k288kkqr.fsf@HIDDEN>
 <87lgsnc0th.fsf@HIDDEN>
Date: Thu, 02 Mar 2017 13:45:57 +0100
Message-ID: <878tonlud6.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha256; protocol="application/pgp-signature"
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 25929
Cc: 25929 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>,
 Tino Calancha <tino.calancha@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

--=-=-=
Content-Type: text/plain

npostavs@HIDDEN writes:

> I guess the backquote is in the wrong place?

Yes, I posted a fix :)

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJYuBQFAAoJECM1h6R8IHkQezAH/138eSec12WdhsT6+Hbk4hwQ
xiZZzWbT+EbEQFPp6aotBPCUnpDR9YsRelO1nFxwqPTkrNioqZgy69ya85D6K82A
B3pP/ctWArLjZLXBeqzz5Tklf34V2tdoGpxYjDWpvrIaPRR+tvmNB4AL4Sb39lgP
P1kjZMIMjVDdp70tPwopX7XiiJtmEuQEx3mSwKzR7uCg8hFoPapre4tBX+BmnC1v
ggDEFMrihv6UPUDJyAoNAOH3maC2N85yJtfSAyWFFMGzoJgSG5gAJM7duuLjWYy0
2E4QzI4rVrgRk6LK17Ba2xb8M3gNf12sylbfuUH/Fts0SS1YgAyjRkZlV5Wk9B0=
=Y0bw
-----END PGP SIGNATURE-----
--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#25929; Package emacs. Full text available.

Message received at 25929 <at> debbugs.gnu.org:


Received: (at 25929) by debbugs.gnu.org; 2 Mar 2017 12:35:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 02 07:35:35 2017
Received: from localhost ([127.0.0.1]:35444 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cjPxH-0002Lf-Kz
	for submit <at> debbugs.gnu.org; Thu, 02 Mar 2017 07:35:35 -0500
Received: from mail-io0-f196.google.com ([209.85.223.196]:36100)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <npostavs@HIDDEN>) id 1cjPxG-0002LU-Qd
 for 25929 <at> debbugs.gnu.org; Thu, 02 Mar 2017 07:35:35 -0500
Received: by mail-io0-f196.google.com with SMTP id 68so4396825ioh.3
 for <25929 <at> debbugs.gnu.org>; Thu, 02 Mar 2017 04:35:34 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=sender:from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=LzoV2fAklLjwdSlVHkcn1TvVDALvoWPwhm+jaTk05iA=;
 b=I9ivuzSlesXJj7t5TsyMoKGTNTjF+gB8RQBO3/O1ZQpr8QfDGb9bXK3nixN3LEDdbt
 uy2oyN6lVpCNz5bNHmjMs/OgJyQvogP7gXh1hNrC3KvRWt7Mp+lQGHVdX5e9YLdNNPLA
 teWE8bqCwAaoTx/J0WPRM3rdVS6QKYV4sNeNx0HETUUWsewPd2O/MWf6G8ZGwZBCb7F8
 QqKvul7nPC5NY9v0SJaKMyrmyxEDg7bgM5MqBdB7/d4fvX29pgZgS/wFLg6MlcNg1WLy
 X32ckhtO1ThGR/SoWlCqZdR1o/mD51foE3vZThn68Rq1GAl00bzqNp7jDtE3QQMJrMuh
 zSmA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:sender:from:to:cc:subject:references:date
 :in-reply-to:message-id:user-agent:mime-version;
 bh=LzoV2fAklLjwdSlVHkcn1TvVDALvoWPwhm+jaTk05iA=;
 b=fXOjHKz+Y1F7q1+Ei0euULQ2qtbVNANmzhQOBW19xLubr4kF7bj+pySJm5Q6H6ZUD+
 f+BWzhriSWZMbifXFPBfxGFNheFtcaCiFP1VIscN4jWYDblobk1YIpBIAKdxyeAi2pDL
 qNzcVYs+eAruf4yuQfKSbM8Ab78S/CQHf86FGDYVP/dpivIVHPck9FW2Rx7Fkubhc2/X
 w3KN/eNhsINz+VGeSO/PN+wrNAzLfXH/QGMwSb24w2EJvrYoxD0wd2A7S4v8BDRujBQo
 X/VVctB4gVQC4EEMTBeDo0wCdNpLU5jQa4iDsmmWhBcMd74Xza9WY+XAAV0sdF71yDcK
 L9Lw==
X-Gm-Message-State: AMke39ljK7nAqyqNACnQY4ylW9diVvZgilDJVxC0grQfPx3MDvNfh+GVXpJkOmBMg9RBRw==
X-Received: by 10.107.135.136 with SMTP id r8mr13099516ioi.36.1488458129299;
 Thu, 02 Mar 2017 04:35:29 -0800 (PST)
Received: from zony ([45.2.7.65])
 by smtp.googlemail.com with ESMTPSA id f127sm8202053ite.26.2017.03.02.04.35.28
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Thu, 02 Mar 2017 04:35:28 -0800 (PST)
From: npostavs@HIDDEN
To: Nicolas Petton <nicolas@HIDDEN>
Subject: Re: bug#25929: 25.2;
 map-delete doesn't delete permanently 1st alist elt
References: <87k288p2oq.fsf@HIDDEN> <87k288kkqr.fsf@HIDDEN>
Date: Thu, 02 Mar 2017 07:36:42 -0500
In-Reply-To: <87k288kkqr.fsf@HIDDEN> (Nicolas Petton's message of "Thu, 02
 Mar 2017 11:59:08 +0100")
Message-ID: <87lgsnc0th.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.2 (/)
X-Debbugs-Envelope-To: 25929
Cc: 25929 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>,
 Tino Calancha <tino.calancha@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.2 (/)

Nicolas Petton <nicolas@HIDDEN> writes:

>     `(macroexp-let2 nil key

I guess the backquote is in the wrong place?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#25929; Package emacs. Full text available.

Message received at 25929 <at> debbugs.gnu.org:


Received: (at 25929) by debbugs.gnu.org; 2 Mar 2017 12:35:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 02 07:35:06 2017
Received: from localhost ([127.0.0.1]:35441 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cjPwo-0002L0-C3
	for submit <at> debbugs.gnu.org; Thu, 02 Mar 2017 07:35:06 -0500
Received: from petton.fr ([89.234.186.68]:60517)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <nicolas@HIDDEN>) id 1cjPwm-0002KR-PR
 for 25929 <at> debbugs.gnu.org; Thu, 02 Mar 2017 07:35:05 -0500
From: Nicolas Petton <nicolas@HIDDEN>
To: Tino Calancha <tino.calancha@HIDDEN>, 25929 <at> debbugs.gnu.org
Subject: Re: bug#25929: 25.2;
 map-delete doesn't delete permanently 1st alist elt
In-Reply-To: <87k288kkqr.fsf@HIDDEN>
References: <87k288p2oq.fsf@HIDDEN> <87k288kkqr.fsf@HIDDEN>
Date: Thu, 02 Mar 2017 13:34:57 +0100
Message-ID: <87efyfluvi.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha256; protocol="application/pgp-signature"
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 25929
Cc: Stefan Monnier <monnier@HIDDEN>, tino.calancha@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

--=-=-=
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

Nicolas Petton <nicolas@HIDDEN> writes:

> The alist is indeed modified within the `map-delete' function, but in an
> unexpected way: if the first key is deleted, the variable `map' is
> `setq'ed, which has no effect outside of the function.
>
> One fix would be to make `map-delete' a macro:

Here's a fixed version:

  (defmacro map-delete (map key)
    "Delete KEY from MAP and return MAP.
  No error is signaled if KEY is not a key of MAP.  If MAP is an
  array, store nil at the index KEY.
=20=20
  MAP can be a list, hash-table or array."
    (macroexp-let2 nil key
      `(progn
         (map--dispatch ,map
           :list (setf (alist-get ,key ,map nil t) nil)
           :hash-table (remhash ,key ,map)
           :array (and (>=3D ,key 0)
                       (<=3D ,key (seq-length ,map))
                       (aset ,map ,key nil)))
         ,map)))

And the associated regression test:

  (ert-deftest test-map-delete-first-key-alist ()
    (let ((alist '((a . 1) (b . 2) (c . 3))))
      (map-delete alist 'a)
      (should (null (map-elt alist 'a)))))

Cheers,
Nico

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJYuBFxAAoJECM1h6R8IHkQtFcH/3WgA6BADyy3I2tVH95mUjgX
6Tdk9YmRyBjGcr++7gN0i1G5EmTMKcT/+tZgJWoeVAHg04k0QX93AMe1mxyKz5ar
iVpSx1OMBE5wyVnQtUIq5YLuZ9C4s7Skgd94txDVTyG9NgZqyO4AxfRAXdcGNxDi
vTkCFEb5lRAgHr8JP/DOUPBayfhgT7pMLayvvlPxxSmaM2UJiFiidqXT8lzitl3b
SdGj+hK97pq8YwJj1mXGeoEvCpXXiZq3Eg2Ka9Z/TvocqAKuTtf7XAhA7KcAurUT
Y7biDns/RDFP0frUPCNW3tFOrRh3rTQTAO25viS7ACKe/X3K83Rmco05hwa7cbw=
=tZE4
-----END PGP SIGNATURE-----
--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#25929; Package emacs. Full text available.

Message received at 25929 <at> debbugs.gnu.org:


Received: (at 25929) by debbugs.gnu.org; 2 Mar 2017 12:27:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 02 07:27:56 2017
Received: from localhost ([127.0.0.1]:35437 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cjPps-0000R4-MD
	for submit <at> debbugs.gnu.org; Thu, 02 Mar 2017 07:27:56 -0500
Received: from petton.fr ([89.234.186.68]:60489)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <nicolas@HIDDEN>) id 1cjPpq-0000Qp-GB
 for 25929 <at> debbugs.gnu.org; Thu, 02 Mar 2017 07:27:55 -0500
From: Nicolas Petton <nicolas@HIDDEN>
To: Tino Calancha <tino.calancha@HIDDEN>
Subject: Re: bug#25929: 25.2;
 map-delete doesn't delete permanently 1st alist elt
In-Reply-To: <alpine.DEB.2.20.1703022028540.30755@calancha-pc>
References: <87k288p2oq.fsf@HIDDEN> <87k288kkqr.fsf@HIDDEN>
 <alpine.DEB.2.20.1703022028540.30755@calancha-pc>
Date: Thu, 02 Mar 2017 13:27:45 +0100
Message-ID: <87h93blv7i.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha256; protocol="application/pgp-signature"
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 25929
Cc: 25929 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>,
 Tino Calancha <tino.calancha@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Tino Calancha <tino.calancha@HIDDEN> writes:

> After this patch if i run the above recipe i get an error:
> let*: Symbol=E2=80=99s function definition is void: map--dispatch

`map--dispatch' is wrapped into a `eval-when-compile' call.  Evaluate
the macro first?

Cheers,
Nico

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJYuA/BAAoJECM1h6R8IHkQfCgH/1pl/dzgKJVefLzuksQ/O2zF
T1bjeth7DXw/f7Lg8a0GFGE7oUEFsBvK9bis/QB6DTRqSwDglFm2o3RhLn8rE+/5
tNA7Sj5nj5yUcVTXBEh+tZy71CH29/lv6zzcL8KZS0nQtTxw8g6sJGCKoPtv1L9C
H9DedqThECvwWnk0GIVJ7sJJyvUvufBFa49vq0/oQV9DmYBuLJkKslxY215dUhEp
OsIVHS5RTDlznmdfifY+0080R8JG7kNPI7oxUiLT2NiwqhbpSPfz8qc0LecEOmdr
FqRpCogy7nvVq4FevM4jnUenvWO5jpAK0b1omOvACsZfSXLI5oxoQI0fs7dlMnQ=
=810N
-----END PGP SIGNATURE-----
--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#25929; Package emacs. Full text available.

Message received at 25929 <at> debbugs.gnu.org:


Received: (at 25929) by debbugs.gnu.org; 2 Mar 2017 11:30:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 02 06:30:48 2017
Received: from localhost ([127.0.0.1]:35404 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cjOwa-0007X6-2K
	for submit <at> debbugs.gnu.org; Thu, 02 Mar 2017 06:30:48 -0500
Received: from mail-pf0-f193.google.com ([209.85.192.193]:34368)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <tino.calancha@HIDDEN>) id 1cjOwW-0007Wr-GI
 for 25929 <at> debbugs.gnu.org; Thu, 02 Mar 2017 06:30:46 -0500
Received: by mail-pf0-f193.google.com with SMTP id x66so6523660pfb.1
 for <25929 <at> debbugs.gnu.org>; Thu, 02 Mar 2017 03:30:44 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:date:to:cc:subject:in-reply-to:message-id:references
 :user-agent:mime-version;
 bh=qdJpgvz3UYI7FH5qj8Q5XSqym8YZAHBIS+EE2b/B+j8=;
 b=b+qEFWoHPCdOHodRNK5PoQcsDDQRMHBKoz0mCnYe/MZRGMsBa7sFAhmO68bJsyMvtd
 TWBUGYodUW7L0E38EWD/hq8xNF1LInm2QuC+HmonM8M5rxjAU39bljL5DqYmD6in33+M
 PrNK8jfWzY4wrgD9GW1Lmu9CoQQoG1ZgTFE4SLjFijnM6VLmj0VHYk+PEMVLmbz1fxDu
 jN8Q6B0x1TO7jtyal6uqBbG55mLo/B/5OQnIIJqxLBjY6805wl+oD4pfkCfDflDWEY96
 OzjuiaCU8ECoJD9ZduyeGJeeFBBpcaNIenFsP0+ChLLk37Arw86YyKHTX93xdIsgNsEW
 NE7Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id
 :references:user-agent:mime-version;
 bh=qdJpgvz3UYI7FH5qj8Q5XSqym8YZAHBIS+EE2b/B+j8=;
 b=nRi+I5S9yvY4looTW6SZh2U/tCT2xiMEetyL3MaQsZmH21aQETqII5uSU2QcmM6Ux0
 +zjb0XWilpVwqHWWo1p1vZTCbdtavZOhqMZXBRlG0KJK6nFkjD3vbR0Trjm2rgF96tMQ
 kWLLb7gwd5WFWSE45K1xNY4PAMAlGlZo8xHZMTmV7YMWCkcoDMEpchwdxDJJ7xgzcRUK
 WjR5gyR62SUOzsxNYMqeKiehTl83Asm8rrOZzSdbHRa8Jm1lCqHogU3fZe7YzvK65tGQ
 EtiQKt8t+HIShm5XV0unibu5Cwd2ZLpKU1Eq6fmTFESeLMOjCOV9/RvJorB/yY6c04Tx
 GA1A==
X-Gm-Message-State: AMke39kxFBy0YgFXKucbZ4I99kNoAtlY1YnPEF07imr5IG6SCXDtUwm0PEw9mGbNkBpFsQ==
X-Received: by 10.99.150.10 with SMTP id c10mr14984854pge.160.1488454238770;
 Thu, 02 Mar 2017 03:30:38 -0800 (PST)
Received: from calancha-pc (104.81.147.124.dy.bbexcite.jp. [124.147.81.104])
 by smtp.gmail.com with ESMTPSA id m12sm16649307pgc.46.2017.03.02.03.30.36
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Thu, 02 Mar 2017 03:30:38 -0800 (PST)
From: Tino Calancha <tino.calancha@HIDDEN>
X-Google-Original-From: Tino Calancha <calancha@HIDDEN>
Date: Thu, 2 Mar 2017 20:30:35 +0900 (JST)
X-X-Sender: calancha@calancha-pc
To: Nicolas Petton <nicolas@HIDDEN>
Subject: Re: bug#25929: 25.2; map-delete doesn't delete permanently 1st alist
 elt
In-Reply-To: <87k288kkqr.fsf@HIDDEN>
Message-ID: <alpine.DEB.2.20.1703022028540.30755@calancha-pc>
References: <87k288p2oq.fsf@HIDDEN> <87k288kkqr.fsf@HIDDEN>
User-Agent: Alpine 2.20 (DEB 67 2015-01-07)
MIME-Version: 1.0
Content-Type: multipart/mixed; BOUNDARY="8323329-1648407496-1488454237=:30755"
X-Spam-Score: 0.4 (/)
X-Debbugs-Envelope-To: 25929
Cc: 25929 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>,
 Tino Calancha <tino.calancha@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.4 (/)

  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

--8323329-1648407496-1488454237=:30755
Content-Type: text/plain; format=flowed; charset=ISO-8859-7
Content-Transfer-Encoding: 8BIT



On Thu, 2 Mar 2017, Nicolas Petton wrote:

> Tino Calancha <tino.calancha@HIDDEN> writes:
>
>
>> (cl-loop for i below 3 collect
>>   (let ((map (list (cons 0 3)
>>                    (cons 1 4)
>>                    (cons 2 5))))
>>     (map-delete map i)
>>     (null (map-elt map i))))
>> => (nil t t) ; The first pair, i.e. '(0 . 3) is not permanently deleted.
>
> The alist is indeed modified within the `map-delete' function, but in an
> unexpected way: if the first key is deleted, the variable `map' is
> `setq'ed, which has no effect outside of the function.
>
> One fix would be to make `map-delete' a macro:
>
> (defmacro map-delete (map key)
>  "Delete KEY from MAP and return MAP.
> No error is signaled if KEY is not a key of MAP.  If MAP is an
> array, store nil at the index KEY.
>
>  MAP can be a list, hash-table or array."
>    `(macroexp-let2 nil key
>       (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))
>

After this patch if i run the above recipe i get an error:
let*: SymbolĘs function definition is void: map--dispatch


--8323329-1648407496-1488454237=:30755--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#25929; Package emacs. Full text available.

Message received at 25929 <at> debbugs.gnu.org:


Received: (at 25929) by debbugs.gnu.org; 2 Mar 2017 10:59:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 02 05:59:19 2017
Received: from localhost ([127.0.0.1]:35370 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cjOS7-0006hX-Lx
	for submit <at> debbugs.gnu.org; Thu, 02 Mar 2017 05:59:19 -0500
Received: from petton.fr ([89.234.186.68]:59306)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <nicolas@HIDDEN>) id 1cjOS5-0006hK-Nf
 for 25929 <at> debbugs.gnu.org; Thu, 02 Mar 2017 05:59:18 -0500
From: Nicolas Petton <nicolas@HIDDEN>
To: Tino Calancha <tino.calancha@HIDDEN>, 25929 <at> debbugs.gnu.org
Subject: Re: bug#25929: 25.2;
 map-delete doesn't delete permanently 1st alist elt
In-Reply-To: <87k288p2oq.fsf@HIDDEN>
References: <87k288p2oq.fsf@HIDDEN>
Date: Thu, 02 Mar 2017 11:59:08 +0100
Message-ID: <87k288kkqr.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha256; protocol="application/pgp-signature"
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 25929
Cc: Stefan Monnier <monnier@HIDDEN>, tino.calancha@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

--=-=-=
Content-Type: text/plain

Tino Calancha <tino.calancha@HIDDEN> writes:


> (cl-loop for i below 3 collect
>   (let ((map (list (cons 0 3)
>                    (cons 1 4)
>                    (cons 2 5))))
>     (map-delete map i)
>     (null (map-elt map i))))
> => (nil t t) ; The first pair, i.e. '(0 . 3) is not permanently deleted.
>
> I've used the word 'permantly' because it seems it is temporary
> deleted:
>
> (cl-loop for i below 3 collect
>   (let ((map (list (cons 0 3)
>                    (cons 1 4)
>                    (cons 2 5))))
>     (null (map-elt
>            (map-delete map i)
>            i))))
> => (t t t)

The alist is indeed modified within the `map-delete' function, but in an
unexpected way: if the first key is deleted, the variable `map' is
`setq'ed, which has no effect outside of the function.

One fix would be to make `map-delete' a macro:

(defmacro map-delete (map key)
  "Delete KEY from MAP and return MAP.
No error is signaled if KEY is not a key of MAP.  If MAP is an
array, store nil at the index KEY.

  MAP can be a list, hash-table or array."
    `(macroexp-let2 nil key
       (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))

WDYT?

Cheers,
Nico

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJYt/r8AAoJECM1h6R8IHkQy60H/3G9VbU2OXHESWYyc549wmT3
HQa7PF2uavzTodgzw0z3lEwdTU+wSu+hproCDqdnXKbz07mnT06D6Jruy3nmb4Vq
WqbQ6Flx2E9tYzd9wt+WIGD4a7VllyFqc/sNYmtJKlQxeMWFxe7zsKekiJLZ/j6D
5WMt8Yc0TBTOGKRyLns8mGFOaJ+DwDwotHYtpXgVlT8+kvq+AwVYTr62Fgdde+MN
LHGsFRWNzCVcRy7UUf56YHpw+AWmnJAFul/DhYWMr32disxqR3wtlAsn4yD2YqkO
rrxjK3GZ6fw7/NgUxyFI6ARvvV2+DfRgvxSOdxbXywJ5aB2xn5S8bpEbw8MTItQ=
=uP/E
-----END PGP SIGNATURE-----
--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#25929; Package emacs. Full text available.

Message received at 25929 <at> debbugs.gnu.org:


Received: (at 25929) by debbugs.gnu.org; 2 Mar 2017 08:56:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 02 03:56:38 2017
Received: from localhost ([127.0.0.1]:35287 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cjMXO-0003rD-7M
	for submit <at> debbugs.gnu.org; Thu, 02 Mar 2017 03:56:38 -0500
Received: from petton.fr ([89.234.186.68]:56420)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <nicolas@HIDDEN>) id 1cjMXM-0003qz-MD
 for 25929 <at> debbugs.gnu.org; Thu, 02 Mar 2017 03:56:37 -0500
From: Nicolas Petton <nicolas@HIDDEN>
To: Tino Calancha <tino.calancha@HIDDEN>, 25929 <at> debbugs.gnu.org
Subject: Re: bug#25929: 25.2;
 map-delete doesn't delete permanently 1st alist elt
In-Reply-To: <87k288p2oq.fsf@HIDDEN>
References: <87k288p2oq.fsf@HIDDEN>
Date: Thu, 02 Mar 2017 09:56:26 +0100
Message-ID: <87y3wokqf9.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha256; protocol="application/pgp-signature"
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 25929
Cc: tino.calancha@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

--=-=-=
Content-Type: text/plain

Tino Calancha <tino.calancha@HIDDEN> writes:

> (cl-loop for i below 3 collect
>   (let ((map (list (cons 0 3)
>                    (cons 1 4)
>                    (cons 2 5))))
>     (map-delete map i)
>     (null (map-elt map i))))
> => (nil t t) ; The first pair, i.e. '(0 . 3) is not permanently
>   deleted.

Thanks for the report! I'll have a look shortly.

Cheers,
Nico

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJYt946AAoJECM1h6R8IHkQDcsH/itowITriOKNhSq6CAUraWAs
CW91IaZ0RTQ07KoimmmiLkfrbYE2q2wMpGFblnowpBsZaRZ+VvWu9lJQt98a/T0o
CyqWJJL6nH02cL38gxIyVs5HMB1B4xorHFa6k7xwsfeqZhPZ3pv1hWOloQ/Cd3tc
W4tTH8XNA2xC87xFmXZLHuocUkwGGX7+L+uz8lolho5/cghbtcDpN9wshS+GWxkJ
SWE8jFPlNl3fkcDnBPfnFq8yIm1B0Wzf2AcVJZobvk8bwKGKBV2G25CRoMPlhffi
s/QeTsENTDbygaX0WS9W1uh+NxhN+UjZgAl9KTsu7oawTA2mX/spni9QLzoEgCY=
=jmjg
-----END PGP SIGNATURE-----
--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#25929; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 2 Mar 2017 07:18:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 02 02:18:15 2017
Received: from localhost ([127.0.0.1]:35249 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cjL0B-0001WB-LP
	for submit <at> debbugs.gnu.org; Thu, 02 Mar 2017 02:18:15 -0500
Received: from eggs.gnu.org ([208.118.235.92]:40953)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <tino.calancha@HIDDEN>) id 1cjL0A-0001Vs-7O
 for submit <at> debbugs.gnu.org; Thu, 02 Mar 2017 02:18:14 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <tino.calancha@HIDDEN>) id 1cjL03-0002qa-TQ
 for submit <at> debbugs.gnu.org; Thu, 02 Mar 2017 02:18:08 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,FREEMAIL_FROM,
 T_DKIM_INVALID autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:45495)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <tino.calancha@HIDDEN>)
 id 1cjL03-0002qW-Qd
 for submit <at> debbugs.gnu.org; Thu, 02 Mar 2017 02:18:07 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:60154)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <tino.calancha@HIDDEN>) id 1cjL02-0001yU-PD
 for bug-gnu-emacs@HIDDEN; Thu, 02 Mar 2017 02:18:07 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <tino.calancha@HIDDEN>) id 1cjKzz-0002pb-K8
 for bug-gnu-emacs@HIDDEN; Thu, 02 Mar 2017 02:18:06 -0500
Received: from mail-pg0-x243.google.com ([2607:f8b0:400e:c05::243]:34077)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <tino.calancha@HIDDEN>)
 id 1cjKzz-0002pS-Dk
 for bug-gnu-emacs@HIDDEN; Thu, 02 Mar 2017 02:18:03 -0500
Received: by mail-pg0-x243.google.com with SMTP id s67so8423344pgb.1
 for <bug-gnu-emacs@HIDDEN>; Wed, 01 Mar 2017 23:18:03 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:mime-version;
 bh=GR/Eq7bleMxpkaPJtnOHtVx4KgNhWMFHGoUGYGEB/Jo=;
 b=bA5j5NV8Rk5xv1lG+b+o+s4JfzAITzUTR1DyUtjUWb86cg9nTDJ4wLePF8dEWtf+lP
 2AxREryDZrAEx0jAfyT7Rif5SpEOVQO+KYDJ8+OD2kAQtefwKx8uUgw2aWpu0jY2yYyi
 vrROVkOOoF9zYn8Va22H2XQjMDVmfwfx1n9Qs0X2h36rpo469rN0DwBQStwsuiWVyCJ7
 +NssyAsMT1eSby/iXpzhhO26IzGVhXZybLD7VV1NcJuuYk5D0+SqA1nZQzvuRDNlX4nj
 6NgNITuN/92Ji6S13+mAs4CdyDMuKv2WsKo/pj871T5aGQTO1an3ON4meGUYuYe3LY54
 vIvA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version;
 bh=GR/Eq7bleMxpkaPJtnOHtVx4KgNhWMFHGoUGYGEB/Jo=;
 b=CCI63y1Tt2bEVXM7+S6TATWaAuobxImZbTOcIfQqCp3Q1Dgd1eU7uGgLOOTZYTLFgI
 TtpC8UO3xIbwJYKbfuqep8bwavbbql/d50J3rI4x4NNBLYQjVRU9GID7JFPtbCsBPlIT
 7tBYXdfeFDz1jC4Imt8ouMEo794ilJMkqHSbGsXGBueRXO35jfmlhRHqmSx0vZ38QKK0
 lp8xTO4DteHVVISxYL6NM0TOueAyD1Eysuq3WkuIXcHBi547LkGsz29+Y1lc/kaECRqt
 oJtpUsseZCjlzN6VNc7SOeVVjGw5nBk+vErMl2zRMc1konxre23+InyT1q+qLGHAex18
 Qw/w==
X-Gm-Message-State: AMke39npxd01HvKBbPwsmA8nySUB9EibRKOhI5xYpBbRp/7LOBN6b9sAdpVUfK1TptUdbA==
X-Received: by 10.84.233.194 with SMTP id m2mr16657596pln.126.1488439082604;
 Wed, 01 Mar 2017 23:18:02 -0800 (PST)
Received: from calancha-pc (104.81.147.124.dy.bbexcite.jp. [124.147.81.104])
 by smtp.gmail.com with ESMTPSA id g85sm14642738pfd.89.2017.03.01.23.18.00
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Wed, 01 Mar 2017 23:18:01 -0800 (PST)
From: Tino Calancha <tino.calancha@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 25.2; map-delete doesn't delete permanently 1st alist elt
Date: Thu, 02 Mar 2017 16:17:57 +0900
Message-ID: <87k288p2oq.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
Cc: tino.calancha@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.0 (----)


X-Debbugs-CC: <nicolas@HIDDEN>

(cl-loop for i below 3 collect
  (let ((map (list (cons 0 3)
                   (cons 1 4)
                   (cons 2 5))))
    (map-delete map i)
    (null (map-elt map i))))
=> (nil t t) ; The first pair, i.e. '(0 . 3) is not permanently deleted.

I've used the word 'permantly' because it seems it is temporary
deleted:

(cl-loop for i below 3 collect
  (let ((map (list (cons 0 3)
                   (cons 1 4)
                   (cons 2 5))))
    (null (map-elt
           (map-delete map i)
           i))))
=> (t t t)

*) It happens just for alist, other maps are fine.
*) The test suite doesn't detect this issue because `test-map-delete'
   happen to delete just the 2rd element of the maps.

In GNU Emacs 25.2.3 (x86_64-pc-linux-gnu, GTK+ Version 3.22.7)
 of 2017-03-02
Repository revision: 640661838dbba8185990e839712c91a14641ddf3




Acknowledgement sent to Tino Calancha <tino.calancha@HIDDEN>:
New bug report received and forwarded. Copy sent to nicolas@HIDDEN, bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to nicolas@HIDDEN, bug-gnu-emacs@HIDDEN:
bug#25929; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Wed, 26 Apr 2017 08:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.