From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: new function proposal alist-to-hash Date: Sat, 05 Oct 2019 11:13:31 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="2909"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Andrea Corallo Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Oct 05 17:14:11 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iGll4-0000aD-Pz for ged-emacs-devel@m.gmane.org; Sat, 05 Oct 2019 17:14:10 +0200 Original-Received: from localhost ([::1]:57288 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iGll3-00062v-LQ for ged-emacs-devel@m.gmane.org; Sat, 05 Oct 2019 11:14:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40528) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iGlkV-00062p-T9 for emacs-devel@gnu.org; Sat, 05 Oct 2019 11:13:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iGlkV-0006lo-05 for emacs-devel@gnu.org; Sat, 05 Oct 2019 11:13:35 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:39745) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iGlkU-0006lX-SM for emacs-devel@gnu.org; Sat, 05 Oct 2019 11:13:34 -0400 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id CB75F84FFB; Sat, 5 Oct 2019 11:13:33 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 8BFA8811DE; Sat, 5 Oct 2019 11:13:32 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1570288412; bh=O0ojSQhV8w68/SEuBYOS7P6ydslEfwZ1CwqWs3Iw8MQ=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=HI6msYu7EMbamvHNOrUzXhr7g9ncg5nFfGNUKPxW1dl4wPriLTyLxg/BSNmohnXnL Ii1aXHNlIZGk93bb8fQbGNY9hD78kxqNsC5+HukVfj4/Desu6EsVQ3p1oUIx5MfFp+ bSjrCfTQsMUKX6THFOMGPF7cJoz9QgrF7qvAMFIxgBjuhT3lG4sQMZp4ySDDsamcpa 5WiKpD1aN5LeS17GE23oXEqurOcmChlqfQ/ehVwuAnJozLxkXbYXXsnDmjEyiDEDEI K4sx97mgJj6gMsz1s/Xl5wZeS4lZz29N1eHk23ZBQDjXJXRA+YgjivDiX9x41uNv9K Up/E5+WyZCgMw== Original-Received: from pastel (76-10-181-40.dsl.teksavvy.com [76.10.181.40]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 4F8BB120B20; Sat, 5 Oct 2019 11:13:32 -0400 (EDT) In-Reply-To: (Andrea Corallo's message of "Sat, 05 Oct 2019 08:18:19 +0000") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 132.204.25.50 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:240616 Archived-At: > Sure, my example was just to point out easiness of use from a syntactic > point of view. The good of having the list quoted by the user is that > he can quasi-quote when needed what he needs. But reading the rest of your response, it seems you're mostly interested in the "literal" case (maybe using backquote+unquote to evaluate some sub-elements). > In python it would be simply something like this: > > nested_dict = { 'dictA': {'key_1': 'value_1'}, > 'dictB': {'key_2': 'value_2'}} Python uses hash-tables to represent objects, whereas in Elisp this is not the case: we use cl-defstruct, alist, or plists instead (hash-tables are considered as relatively expensive, so if you know there will only be a small number of entries, you're often better off with an alist). Nested hash-tables are very rare in Elisp (so far). Stefan