[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.lisp

Re: Loop "For" clause after "where" clause?

William James

8/11/2015 4:43:00 AM

Rob Warnock wrote:

> | > In cl-http there are a lot of uses of loop in the following style
> | > (simplified)
> | > (loop with idx = 0 and end = 3
> | > while (< idx end)
> | > for char = (aref "012" idx)
> | > do (print char)(incf idx))
> | >
> | > Is the above pattern indeed incorrect?
> |
> | I believe so.
> +---------------
>
> Yup, incorrect. From CLHS "Macro LOOP" <URL:http://www.lisp...
> reference/HyperSpec/Body/m_loop.htm>:
>
> loop [name-clause] {variable-clause}* {main-clause}* => result*
> ...
> variable-clause::= with-clause | initial-final | for-as-clause
> ...
> main-clause::= unconditional | accumulation | conditional |
> termination-test | initial-final
> ...
> termination-test::= while form | until form | repeat form |
> always form | never form | thereis form
>
> Therefore all FOR (and WITH) clauses must precede all WHILE clauses.


Paul Graham:

I consider Loop one of the worst flaws in CL, and an example
to be borne in mind by both macro writers and language designers.

--
[W]e had enough employees who made more than 85 to fill all the openings. The
highest score that any of the blacks scored on the test was 11. The lowest
score that any black made on the test was 4. All four of those blacks went
into skilled-trades training.
https://archive.org/download/TheOldmanArchives/oldman29-...