Subject: Re: newbie needs simple help
From: Erik Naggum <erik@naggum.net>
Date: 2000/11/10
Newsgroups: comp.lang.lisp
Message-ID: <3182859272653997@naggum.net>

* "dalmas" <dalmas14@hotmail.com>
| (defun myloop (x)
|   (loop
|     (progn (print x)
|     (setf x (1- x))))

  You can lose the progn.

| but i cant work out where to put in an escape clause (until (= x 0)) .

(when (= x 0) (return))

  escapes from the (simple) loop body.

  If you want a more interesting view on loop, the extended loop offers
  a much broader and more interesting approach, as in:

(loop for x from 100 above 0 do (print x))

  However, in this particular case, you probably want a more specialized
  form (although this prints in reverse order from what you specified):

(dotimes (x 100) (print x))

  I suggest you return to that mental state where you don't know the
  language (like learning your first language) and only after you learn
  something in it, compare it with other languages you know, if you at
  all find that necessary in this learning process.  This won't take any
  more time than trying to match things up before you understand them.
  Quite the contrary, in fact.

#:Erik
-- 
  ALGORITHM: a procedure for solving a mathematical problem in a finite
  number of steps that frequently involves repetition of an operation.
  ALGOREISM: a procedure for solving an electoral problem in a finite
  number of steps that frequently involves repetition of an operation.