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

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

RE: [External] : Re: append, push, and add-to-list.


From: Drew Adams
Subject: RE: [External] : Re: append, push, and add-to-list.
Date: Mon, 5 Jul 2021 16:19:01 +0000

> An unquoted list would be, for example, (list 1 2 3) So to
> keep it consistent, without a quote, would it be
>   (defvar lst)
>   (setq lst (list)) ; nil
> ?

If you really want, yes you can write `(list)'.
That evaluates to nil just like nil, '(), and () do.

`list' is a function.  `(list ...)' is a function call.

() is not a function call.  It's a constant.
It's just alternative _syntax_ for nil.

'() is syntax for the special form `(quote ())'.

All of `(list)', (), '(), and nil evaluate to nil.

> '() makes it easier to spot immediately, hey,
> that's an empty list.

To each their own. ;-)  I don't find '() easier
to spot than ().

> But ... ultimately one writes code so the computer can execute
> it, and not so that a human can read it. So maybe one
> shouldn't quote empty lists?
> 
> If so, I have 14 corrections to make...

No, the computer couldn't care less whether
you write (list), nil, (), or '(). ;-)

<<attachment: winmail.dat>>


reply via email to

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