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

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

Re: FW: How to avoid compiler warning `unused lexical variable' for `dol


From: Stefan Monnier
Subject: Re: FW: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?
Date: Thu, 07 Jan 2021 22:31:25 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

>> The third arg is different from "the expression after `dotimes`" in one
>> important respect: the third arg can refer to the iteration variable
>> which will contain the "last" value:
>>     (dotimes (i 10 i) nil)
>> will return 10.
>
> In Common Lisp, at least, both dolist and dotimes let the return expression
> you specify refer to the iteration variable.  The difference is that for
> dolist the value at the end is nil; for dotimes it is the number
> of iterations.

IIRC we consciously decided to break this compatibility in `dolist`
because a variable that's always bound to nil is not useful enough to
justify the extra hassle.


        Stefan




reply via email to

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