Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Slimmed "format"; no "loop"

Author: Tord Romstad

Date: 05:43:30 03/25/04

Go up one level in this thread


On March 25, 2004 at 08:17:43, Steven Edwards wrote:

>The Common Lisp spec for "loop" is far worse than "format".  It is a fine
>example of why programming languages should NOT be designed by committee.
>(ChessLisp has no "loop" intrinsic.)

I happen to like the LOOP macro a lot, although I admit that it tends to look
ugly when people overuse the more advanced features.

I regard DO (like TAGBODY and UNWIND-PROTECT) as mainly a low-level construct
which is sometimes useful for building more high-level macros, it is not
something I want to see as part of normal code.  LOOP, if used wisely, is
much prettier and easier to read.

The below example from the HyperSpec is a nice example.  I find it hard
to see how you could write the same code as readable and clear as this
with any of the other built-in looping constructs.

;; Another example of the extended form of LOOP.
 (loop for n from 1 to 10
       when (oddp n)
         collect n)
=>  (1 3 5 7 9)


Tord



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.