From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Rusi Newsgroups: gmane.emacs.help Subject: Re: plists, alists, and hashtables (was: How to iterate over properties in a plist?) Date: Tue, 4 Aug 2015 21:36:26 -0700 (PDT) Message-ID: <02f81836-554f-4bb4-873b-85c24e080e3d@googlegroups.com> References: <876150vwaa.fsf@mbork.pl> <873803x5q4.fsf@kuiper.lan.informatimago.com> <87a8u7we9s.fsf_-_@lifelogs.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1438749621 11015 80.91.229.3 (5 Aug 2015 04:40:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 5 Aug 2015 04:40:21 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Aug 05 06:40:21 2015 Return-path: Envelope-to: geh-help-gnu-emacs@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 1ZMqUz-0005Dq-FU for geh-help-gnu-emacs@m.gmane.org; Wed, 05 Aug 2015 06:40:17 +0200 Original-Received: from localhost ([::1]:39057 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZMqUy-0006cK-DS for geh-help-gnu-emacs@m.gmane.org; Wed, 05 Aug 2015 00:40:16 -0400 X-Received: by 10.129.77.85 with SMTP id a82mr6265524ywb.17.1438749387127; Tue, 04 Aug 2015 21:36:27 -0700 (PDT) X-Received: by 10.50.66.129 with SMTP id f1mr127000igt.4.1438749387099; Tue, 04 Aug 2015 21:36:27 -0700 (PDT) Original-Path: usenet.stanford.edu!z61no5310342qge.0!news-out.google.com!o13ni7092igw.0!nntp.google.com!f3no7677872igg.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help In-Reply-To: <87a8u7we9s.fsf_-_@lifelogs.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=61.1.36.63; posting-account=mBpa7woAAAAGLEWUUKpmbxm-Quu5D8ui Original-NNTP-Posting-Host: 61.1.36.63 User-Agent: G2/1.0 Injection-Date: Wed, 05 Aug 2015 04:36:27 +0000 Original-Xref: usenet.stanford.edu gnu.emacs.help:213953 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:106238 Archived-At: On Tuesday, August 4, 2015 at 3:45:32 PM UTC+5:30, Ted Zlatanov wrote: > On Sat, 01 Aug 2015 18:49:38 -0400 Stefan Monnier wrote: > > SM> - plists need to be "parsed" in order to figure out if an element is a key > SM> or a value. > > That's true, but there's some idea that a plist is "correct" if it can > be parsed. It's also visually easier to parse, I think, especially for > beginners. Also, symbol plists are pretty well ensconced at the C level. > > By contrast, alists don't have a strong structure and parsing them is > not simple for beginners. For instance: > > (alist-get 'a '((a) (b 1) (c . 2) d)) -> nil > (alist-get 'b '((a) (b 1) (c . 2) d)) -> (1) > (alist-get 'c '((a) (b 1) (c . 2) d)) -> 2 > (alist-get 'd '((a) (b 1) (c . 2) d)) -> nil ; no error > > The real map type in Emacs Lisp is the hashtable, I think. But because > of historical baggage, we end up discussing the benefits of two list > formats when used as maps. Which feels like discussing which of two > different bicycles is better for carrying 5 people. +1 Since I always seem to be carrying on about emacs carrying ancient baggge I did not say it. 50 years ago using association lists to model associations was real neat. However after perl and python (and awk) and... almost any language invented in the last 20 years, its rather backward. The efficiency is one thing The clumsy syntax is the bigger one (for me)