help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: plists, alists, and hashtables (was: How to iterate over properties


From: Rusi
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)
User-agent: G2/1.0

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)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]