[Top][All Lists]

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

Re: Cycle Org Shift Select

From: Michael Heerdegen
Subject: Re: Cycle Org Shift Select
Date: Tue, 10 Nov 2020 12:10:53 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Christopher Dimech <> writes:

> Many thanks Tomas, have gone though the Elisp Manual yesterday
> and I am getting to understand this list Ouroboros thing. :)

If you want a simple way to think about it starting from a syntax point
of view:

A very simple way to think about the dotted syntax is to start from
regular lists.  You can write

  (elt1 elt2 . rest)

to describe a list of the elements elt1 elt2 (any positive number of
starting elements will do) with the elements in the list `rest'
appended. For example try to eval

  '(x y . ())


  '(x y . (z))

(You need the quote "'" because we don't want to evaluate the lists as
an expression.)

Of course the dot syntax is ambiguous, e.g.

  '(x y z)
  '(x . (y z))
  '(x . (y . (z)))
  '(x . (y . (z . ())))

all describe equal three element lists containing the symbols x, y and z.

Then you need to know that the "rest" can be actually anything.  If the
`rest' doesn't describe a regular list, you get a "dotted" list (it will
be printed using the dot syntax).  In the simplest case

  (x . y)

you have a pair, a `cons' cell which is the building block lists are
constructed from in Lisp.  A cons with a list cdr is also a list.

And when `rest' refers to the list itself (possible using the # reader

  '#1=(nil t always . #1#)

you get a circular list.


reply via email to

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