[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.lisp

Re: wxPython and macros (was: Why don't people like lisp?

William James

8/1/2015 6:33:00 AM

Pascal Costanza wrote:

> Consider the following two functions that both do the same thing:
>
> (defun example-1 (x)
> (let ((i 0))
> (tagbody
> :loop
> (when (> i x) (go :end))
> (print i)
> (incf i)
> (go :loop)
> :end)))
>
> (defun example-2 (x)
> (loop for i from 0 to x
> do (print i)))
>
> EXAMPLE-1 requires lots of book-keeping in your head, especially when
> things get messier. EXAMPLE-2 uses a for loop "just" to reduce
> book-keeping and visual clutter. ;)

Gauche Scheme:

(for-each print (lrange 0 3))
===>
0
1
2


Another way:

(dotimes (i 3) (print i))

Another way:

(use srfi-42 :only (do-ec))
(do-ec (: i 3) (print i))

--
Viewed at its most abstract level, a fundamental agenda is thus to influence
the European-derived peoples of the United States to view concern about their
own demographic and cultural eclipse as irrational and as an indication of
psychopathology. --- Dr. Kevin MacDonald; "The Frankfurt School of Social
Research and the Pathologization of Gentile Group Allegiances"