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

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

Re: Easy to add with push but not to the end of a list


From: tomas
Subject: Re: Easy to add with push but not to the end of a list
Date: Tue, 29 Nov 2022 06:23:22 +0100

On Mon, Nov 28, 2022 at 10:01:24PM +0000, Heime wrote:
> ------- Original Message -------
> On Monday, November 28th, 2022 at 8:19 PM, Emanuel Berg <incal@dataswamp.org> 
> wrote:
> 
> 
> > Stefan Monnier via Users list for the GNU Emacs text editor wrote:
> > 
> > > > Although it is easy to add to a list using push, it
> > > > currently looks hideous to be able to add to the end of
> > > > a list.
> > > 
> > > That's because adding to the end of a Lisp list is
> > > a bad idea.
> 
> The bad idea comment disregards necessity...

Q "But I /want/ to hit this nail into the wall with a spoon!"

A "You can try. But please, do it in your living room. And
   oh, with your own spoon"

Programming is somewhere between engineering and craft. In
these realms, you usually try to think about what tools are
appropriate for a job.

Singly linked lists are a tool. They are simple, lightweight,
and appropriate for keeping things in sequence, and for adding
things at the front. Not at the end.

Core library functions express idioms. They are expected to
help people to find patterns on how to use tools appropriately
(it's not much different from tools: a screwdriver has a
handle, which spells "grip me here, please").

Adding a function to core (say `hsup') which suggests that
it is as easy to push something at the end of a list would
be misleading people to hold the screwdriver (or the knife!)
at the wrong end and hurt themselves.

Cheers
-- 
t

Attachment: signature.asc
Description: PGP signature


reply via email to

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