all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Eli Zaretskii <eliz@gnu.org>, uzibalqa <uzibalqa@proton.me>
Cc: "64692-done@debbugs.gnu.org" <64692-done@debbugs.gnu.org>
Subject: bug#64692: Better descriptions of Cons Cells and Dotted Notation with real-life syntax
Date: Tue, 18 Jul 2023 17:13:56 +0000	[thread overview]
Message-ID: <SJ0PR10MB5488B7701EECF99A84158449F338A@SJ0PR10MB5488.namprd10.prod.outlook.com> (raw)
In-Reply-To: <83pm4p7ane.fsf@gnu.org>

> > Whereas the Emacs
> > Lisp Reference Manual isn't designed as a tutorial with explanations,
> > the "Introduction to Programming in Emacs Lisp" simply refers to the
> > "Emacs Lisp Reference Manual" for understanding Cons Cells and Dotted
> > Notation.
> >
> > This means that the "Introduction to Programming in Emacs Lisp" would
> > benefit from some real-life list syntax. Currently I find it short
> > and far from real-life.
> 
> The Introduction manual has a node "List diagrammed", to which you
> will get if you type "i cons cell RET", which describes that, with
> pictures.

That node doesn't explain dot notation.
It does have a link to the Elisp manual for
that.  But it doesn't even show an example
of dot notation.  A reader may well wonder
why there's a link for "Dotted Pair Notation".

It would be good to show Lisp notation for
some of the cons-cell diagrams it presents.
It does show that for (violet buttercup).
It would do well to say that this is the
same as (violet . (buttercup)) and the same
as (violet . (buttercup . nil)).  IOW, show
dot notation as a succinct version of the
cons-cell diagrams.  And say that the Lisp
reader can read this syntax:
(violet . (buttercup . nil)) is read the
same as is (violet buttercup).

This is a useful bit of Lisp knowledge, and
it's missing from the intro Elisp manual.

Nothing in the intro Elisp manual presents
dot notation.  The most it says about list
notation is that a list of items a, b, and
c is written (a b c).

The intro Elisp manual _shows_ dot notation
in passing in a couple places (e.g., custom
entry in init file), but it doesn't explain
or even mention the notation at all.  It
at least points to the existing explanation
in the Elisp manual, in its nodes Build a
List and Lists diagrammed. 

But preferably the intro manual would itself
introduce the notation briefly.

The intro manual goes into the whole cons-cell
diagramming thing.  It would do well to tie
that explanation to the Lisp notation for
lists, which includes dot notation and the
identity of (a) with (a . nil), and thus the
identity of (a b c) with (a . (b . (c . nil))).

> So I don't think we have any problems in this area, 
> and I'm therefore closing this bug.

I think this enhancement request should remain
open.  It could reasonably be on the list of
other possible improvements to the intro Elisp
manual.

A reader of the intro Elisp manual should be
exposed to this syntax, IMHO.  (a . (b . nil))
is a beautiful depiction of the corresponding
cons-cell diagram.





      parent reply	other threads:[~2023-07-18 17:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-17 20:17 bug#64692: Better descriptions of Cons Cells and Dotted Notation with real-life syntax uzibalqa via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-18 10:32 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-18 10:36   ` Ihor Radchenko
2023-07-18 12:42     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-18 12:58       ` Christopher Dimech
2023-07-18 13:24         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-18 17:20   ` Drew Adams
2023-07-18 17:32     ` uzibalqa via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-18 10:54 ` Eli Zaretskii
2023-07-18 11:19   ` uzibalqa via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-18 17:13   ` Drew Adams [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SJ0PR10MB5488B7701EECF99A84158449F338A@SJ0PR10MB5488.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=64692-done@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=uzibalqa@proton.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.