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

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

Re: append, push, and add-to-list.


From: Emanuel Berg
Subject: Re: append, push, and add-to-list.
Date: Mon, 05 Jul 2021 16:53:44 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Drew Adams wrote:

>> But with '() you see that it is (an empty) list:
>> 
>>   (defvar lst)
>>   (setq lst '())
>
> Yes, for human reading, () suggests that the value might be
> used as a list, and nil suggests that it might not be (e.g.,
> it might be used as a truth value or otherwise).
>
> But there is no reason to quote (). Like t, () is evaluates
> to itself.

Yes, there is a reason, it feels natural because of the way of
creating lists like this '(raz dva tri)

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

?

Is it just me, or does Lisp have so many
parenthesis everywhere? '() makes it easier to spot
immediately, hey, that's an empty list.

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...

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

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