[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.lisp

Re: need help w/ `loop'

William James

5/12/2015 11:02:00 AM

> This baffles me:
>
> (loop for i from 0 to 3
> with result = 0
> do
> (incf result i)
> return result)
>
> ==> 0
>
> Why? doesn't the stuff that occurs in the body of the `loop' make a
> difference? What am I missing?

Why didn't you do it this way?

(let ((result 0))
(loop for i from 0 to 3
do (incf result i))
result)

Why does it make worshippers of CL (COBOL-Like) so happy to do
everything inside of LOOP?

Why didn't you believe Paul Graham when he told you that LOOP
is a disaster?

Gauche Scheme:

(let1 result 0
(dotimes (i 4) (inc! result i))
result)

===>
6

--
[T]wo Muslim Turkish teens gang-raped a 16-year-old girl.... It was an attack
of almost unthinkable savagery. When they finished raping the girl, they then
assaulted her with a bottle. Even when the bottle broke, they continued her
attack, eventually severing her intestine and her uterus.... [H]er rectum was
so destroyed by the attack that physicians had to create an artificial one for
her. German privacy laws meant that the attack went entirely unreported in the
German press. http://www.liveleak.com/view?i=807_...