From Newsgroup: comp.lang.lisp
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. ;)
Why does the number being printed have to have a name?
Why not just say "Print each number"?
Gauche Scheme:
(for-each print (liota 3))
===>
0
1
2
--- Synchronet 3.21d-Linux NewsLink 1.2