[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: How to avoid compiler warning `unused lexical variable' for `dolist'
From: |
Drew Adams |
Subject: |
RE: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'? |
Date: |
Thu, 7 Jan 2021 19:03:06 -0800 (PST) |
> It's hidden because it's not at the usual place where the return value
> is usually placed (i.e. in the last expression).
>
> There are several other macros/specialforms that also place the return
> value elsewhere than the last expression, such as `unwind-protect`, (and
> to a lesser extent `if`, `cond`, `condition-case`, `prog1`), but these
> still place the return value in one of the immediate subexpressions,
> many of them use indentation to try and make the return value "stand
> out" from the rest, etc...
>
> In contrast in `dotimes` and `dolist` it's placed in
> a sub-sub-expression and moreover it's one that's rarely used (arguably
> *because* it's too deeply nested), so you're likely to miss it if you
> don't go looking for it very actively.
>
> Not that it matters anyway,
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's nothing particularly odd, new, or unlispy about such design. It's very
old in Lisp iteration.
And most such iteration constructs wrap everything in an implicit nil block, so
you can also use `return' anywhere to return a value.
https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node88.html
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, (continued)
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, Philipp Stephani, 2021/01/08
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, Emanuel Berg, 2021/01/08
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, tomas, 2021/01/08
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, Jean Louis, 2021/01/09
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, Leo Butler, 2021/01/09
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, Philipp Stephani, 2021/01/09
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, Leo Butler, 2021/01/09
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, Stefan Monnier, 2021/01/09
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, Leo Butler, 2021/01/11
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, Stefan Monnier, 2021/01/11
- RE: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?,
Drew Adams <=
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, Stefan Monnier, 2021/01/07
- RE: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, Drew Adams, 2021/01/08
- How to get plist properties list?, Jean Louis, 2021/01/07
- Re: How to get plist properties list?, Stefan Monnier, 2021/01/08
- Re: How to get plist properties list?, Jean Louis, 2021/01/08
- Re: How to get plist properties list?, Stefan Monnier, 2021/01/08
- Re: How to get plist properties list?, Jean Louis, 2021/01/09
- Re: How to get plist properties list?, tomas, 2021/01/09
- Re: How to get plist properties list?, Jean Louis, 2021/01/10
- Re: How to get plist properties list?, Stefan Monnier, 2021/01/09