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

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

Re: How to get plist properties list?


From: tomas
Subject: Re: How to get plist properties list?
Date: Sat, 9 Jan 2021 10:27:33 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Sat, Jan 09, 2021 at 10:54:17AM +0300, Jean Louis wrote:
> * Stefan Monnier <monnier@iro.umontreal.ca> [2021-01-08 09:51]:
> > > I would like to understand what is the problem. I don't. You tell me
> > > that `elt' is problem, that is how I understand it.
> > >
> > > Could I maybe rather use `nth' to replace `elt'?
> > 
> > No, same problem.
> > Think of it this way: consider your list of N elements as a road that's
> > N kilometers long [...]

(nice explanation, BTW :)

> So far I have seen from similar discussion on `length' on emacs-devel
> mailing list [...]

When you have a toolbox (a language & library), you usually develop
a set of "ways of doing things", corresponding to the properties
your tools have.

> If I wish to get the element like number 17th I do not know what I
> should do.

  (nth 17 my-list)

Unless... you are doing it very often. Then you do something
different (unless, again, you don't care that your program is
slow; if you are giving your program to other people, you should
care, somewhat, at least. And so on.

Lists are very flexible data structures. But they have one downside:
accessing a random element in them takes as long as walking through
half of it, in the average.

If you plan to access elements by index, Emacs Lisp has arrays.
They aren't as flexible, but faster for random access. If you
want more flexibility, there are hash tables. And so on.

It's like with tools. You use the screwdriver to drive screws.
In a pinch, you can use it to poke dirt out of a hole. I've
seen people using it to hit a hole in a wall (hm.) or even to
drive a nail into a piece of wood (ouch!).

Cheers :)
 - t

Attachment: signature.asc
Description: Digital signature


reply via email to

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