From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Andrea Corallo Newsgroups: gmane.emacs.devel Subject: Re: new function proposal alist-to-hash Date: Sat, 05 Oct 2019 15:45:45 +0000 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="132392"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (berkeley-unix) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Oct 05 17:46:29 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 1iGmGL-000YIu-8C for ged-emacs-devel@m.gmane.org; Sat, 05 Oct 2019 17:46:29 +0200 Original-Received: from localhost ([::1]:57472 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iGmGI-0007Qp-6F for ged-emacs-devel@m.gmane.org; Sat, 05 Oct 2019 11:46:26 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46326) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iGmFi-0007Qb-Sv for emacs-devel@gnu.org; Sat, 05 Oct 2019 11:45:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iGmFg-0007KO-AU for emacs-devel@gnu.org; Sat, 05 Oct 2019 11:45:50 -0400 Original-Received: from mx.sdf.org ([205.166.94.20]:62890) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iGmFg-0007Jx-3T for emacs-devel@gnu.org; Sat, 05 Oct 2019 11:45:48 -0400 Original-Received: from sdf.org (IDENT:akrl@sverige.freeshell.org [205.166.94.5]) by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id x95FjjVl028176 (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256 bits) verified NO); Sat, 5 Oct 2019 15:45:46 GMT Original-Received: (from akrl@localhost) by sdf.org (8.15.2/8.12.8/Submit) id x95FjjfB019953; Sat, 5 Oct 2019 15:45:45 GMT In-Reply-To: (Stefan Monnier's message of "Sat, 05 Oct 2019 11:13:31 -0400") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 205.166.94.20 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:240620 Archived-At: Stefan Monnier writes: >> 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). Correct. >> 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). I guess one of the reasons is that as discussed depending on the case expressing them in a literal form can be not so convenient. > Stefan > Bests Andrea -- akrl@sdf.org