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

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

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


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

> FWIW, Common Lisp has several iteration constructs that let you specify an
> optional return value up front (as you would say, in a sub-sub-expression).
> Not just `dolist' and `dotimes'.  `do', for instance.

There are a few other such cases, indeed.  I think most of them are like
`do` in the sense that they're *very* rarely used in ELisp (and
correspondingly most ELisp programmers have no idea what it does).

FWIW, I remember that I used to like `do*` back when I was programming
in Common Lisp, but nowadays I find it rather inscrutable.

In that category I think Scheme's named let is infinitely superior: both
more general and easier to understand.  Too bad that it's kind of a pain
to implement efficiently in ELisp, but Vincent's `recur-let` gives
a pretty good approximation (still more general and easier to understand
than `do*`).
(c.f. https://github.com/VincentToups/recur).

> There's nothing particularly odd, new, or unlispy about such design.
> It's very old in Lisp iteration.

Old doesn't mean good.


        Stefan




reply via email to

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