all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Emanuel Berg <incal@dataswamp.org>,
	"help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: RE: [External] : Re: Setting up abbrev
Date: Mon, 1 Aug 2022 19:20:20 +0000	[thread overview]
Message-ID: <SJ0PR10MB54881927BF0CAECBFACA1AADF39A9@SJ0PR10MB5488.namprd10.prod.outlook.com> (raw)
In-Reply-To: <87mtcnbykf.fsf@dataswamp.org>

> > You can use a dotted list in these cases:
> >
> > 1. You want to save conses (not create so many), in
> >    a context where you're not going to be needing to use the
> >    cons as a list (mapping etc.), or a context where you
> >    know you'll only ever want an atom cdr.
> >
> > 2. You want/need, in effect, to have a backwards key-value
> >    pair, (list-value . atom-key). You have a list to use for
> >    most purposes (ignoring the last cdr), and you have an
> >    atom (the cdr) for a few rare purposes, as a kind of
> >    label for the list.
> >
> > #2 is usually the result of trying to adapt to legacy code
> > that expects to treat just a list (and doesn't need to
> > follow it to its end). IOW, #2 is typically an ugly hack.
> > For new code you'd instead just put the atom first:
> > (atom-key . list-value).
> 
> Why? What data can (a . b) hold that (list a b) cannot?

Please reread what I wrote.  I never said that
(a . b) can hold data that (a b) cannot.  Nothing
like that.


I said:

1. (a . b) uses one less cons than (a b).

2. If you need to support legacy code that expects
to use a list (a b c), but you also want to label
such a list with an atom, you can sometimes use
(a b c . d) to get away with doing both.

That's all.  If the performance (space or access
time) of (a b) isn't a problem for your app, then
#1 probably doesn't apply.  If you don't need to
cover legacy cases such as #2 describes, then #2
probably doesn't apply.

Those are two use cases that come to (my) mind.



  reply	other threads:[~2022-08-01 19:20 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-31 12:23 Setting up abbrev wilnerthomas--- via Users list for the GNU Emacs text editor
2022-07-31 13:08 ` Jean Louis
2022-08-01  3:06   ` Emanuel Berg
2022-08-01  6:04     ` Jean Louis
2022-08-01  7:42       ` Emanuel Berg
     [not found] ` <YuZ+ucBrwA9vOR/F@protected.localdomain-N8JMuQk----2>
2022-07-31 15:35   ` wilnerthomas--- via Users list for the GNU Emacs text editor
2022-07-31 16:40     ` [External] : " Drew Adams
2022-08-01  6:21       ` Jean Louis
2022-08-01  6:05     ` Jean Louis
2022-07-31 20:02 ` kf
2022-08-01  3:03 ` Emanuel Berg
2022-08-01 10:41   ` uzibalqa
2022-08-01 11:39     ` Emanuel Berg
2022-08-01 14:56       ` [External] : " Drew Adams
2022-08-01 15:14         ` Emanuel Berg
2022-08-01 16:36           ` Drew Adams
2022-08-01 16:57             ` wilnerthomas--- via Users list for the GNU Emacs text editor
2022-08-01 18:36             ` Emanuel Berg
2022-08-01 19:20               ` Drew Adams [this message]
2022-08-01 16:56       ` tomas
2022-08-01 18:40         ` Emanuel Berg
2022-08-01 20:37           ` tomas
2022-08-01 11:33   ` carlmarcos--- via Users list for the GNU Emacs text editor
2022-08-01 11:42     ` Emanuel Berg
2022-08-01 12:54       ` carlmarcos--- via Users list for the GNU Emacs text editor

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=SJ0PR10MB54881927BF0CAECBFACA1AADF39A9@SJ0PR10MB5488.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=incal@dataswamp.org \
    /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.