Some express distaste for Common Lisp's new LOOP feature, but
I don't understand why. No one objects to the PROG feature,
which allows one to write programs. Similarly, the LOOP form
is for loops. For instance, to find the total temperature of
STARLIST, a list of stars represented as lists whose third
element is their temperature, with just the PROG feature one
would write
(prog (temp ttemp)
(psetq ttemp 0
temp starlist)
loop
(cond ((null temp) (return ttemp)))
(psetq ttemp (+ ttemp (caddar temp))
temp (cdr temp))
(go loop))
but LOOP allows the computation to be expressed more
conversationally
(loop with ttemp = 0
for star in starlist
do add caddr of star to ttemp
finally return ttemp)
while remaining more efficient than the ugly
(reduce #'+ (mapcar #'caddr starlist))
or
(apply + (map caddr starlist))
advocated by socialist europeons and ivory tower Schemerrhoids.
Written 1990, Barak
A. Pearlmutter.
Kindly endorsed by Olin Shivers.