From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Using gv in map and seq? Date: Tue, 16 Jun 2015 20:41:54 -0400 Message-ID: References: <87egldxn7p.fsf@petton.fr> <878ublkrqe.fsf@petton.fr> <871thbbdd0.fsf@petton.fr> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1434501753 4625 80.91.229.3 (17 Jun 2015 00:42:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 17 Jun 2015 00:42:33 +0000 (UTC) Cc: emacs-devel To: Nicolas Petton Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jun 17 02:42:20 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Z51Qm-0007YT-4Z for ged-emacs-devel@m.gmane.org; Wed, 17 Jun 2015 02:42:16 +0200 Original-Received: from localhost ([::1]:43479 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z51Ql-0002x7-FU for ged-emacs-devel@m.gmane.org; Tue, 16 Jun 2015 20:42:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45656) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z51QY-0002uH-Jv for emacs-devel@gnu.org; Tue, 16 Jun 2015 20:42:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z51QS-0006Ix-5o for emacs-devel@gnu.org; Tue, 16 Jun 2015 20:42:02 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:19443) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z51QS-0006Ir-2B for emacs-devel@gnu.org; Tue, 16 Jun 2015 20:41:56 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0DjFgA731xV/1enxEVcgxCEAoVVwgOBCAQCAoE8PRABAQEBAQEBgQpBBYNdAQEDAVYREgULCzQSFBgNJIg3CM8jAQEIAgEfizqEUjMHhC0Fsz+BRSOCChyBbiKCeAEBAQ X-IPAS-Result: A0DjFgA731xV/1enxEVcgxCEAoVVwgOBCAQCAoE8PRABAQEBAQEBgQpBBYNdAQEDAVYREgULCzQSFBgNJIg3CM8jAQEIAgEfizqEUjMHhC0Fsz+BRSOCChyBbiKCeAEBAQ X-IronPort-AV: E=Sophos;i="5.13,465,1427774400"; d="scan'208";a="126868034" Original-Received: from 69-196-167-87.dsl.teksavvy.com (HELO ceviche.home) ([69.196.167.87]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 16 Jun 2015 20:41:54 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id BC4D966166; Tue, 16 Jun 2015 20:41:54 -0400 (EDT) In-Reply-To: <871thbbdd0.fsf@petton.fr> (Nicolas Petton's message of "Tue, 16 Jun 2015 22:35:39 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:187228 Archived-At: >>> Something like the patch below seems to work (and it generalizes >>> map-put to accept for MAP not only symbols but any "lvalue"). It also >>> tightens the code generated by map--dispatch. > But you have completely removed `map-put' here, right? Is it supposed to > be implemented in terms of `map-elt' now that it is "set-able"? Indeed, it becomes redundant: you can use (setf (map-elt M K) V) =E0 la pla= ce. > > Something like the patch below seems to work (and it generalizes > > map-put to accept for MAP not only symbols but any "lvalue"). > For lists, yes indeed. I was looking for a simple way to do that, > thanks! Since the macro-expansion is done before we know what type we'll get, the restriction to lvalues carries over to all other types :-( > Je bloque sur ton code, quand j'=E9value > > (setq my-map '()) > (setf (map-elt my-map 'b) 4) > > J'ai une erreur `Debugger entered--Lisp error: (void-variable map)' Il y a en tout cas l'erreur ci-dessous qu'il faut corriger: > > + `(map--dispatch map ^^^ ,map -- Stefan