Subject: Re: Two DO questions
From: Erik Naggum <erik@naggum.no>
Date: 03 Jan 2003 23:23:28 +0000
Newsgroups: comp.lang.lisp
Message-ID: <3250625008424209@naggum.no>

* Jules Grosse
| 1) How can I reproduce the following behaviour:
| 
| (dotimes (x 10) 
|   (dotimes (y 10) 
|     (do-something-with x y)))
| 
| Using only one "do" construct?  How about only one "loop" construct?

  It does appear to be homework, so it may be instructive to look at
  what Common Lisp may look like and yet be maximally inadmissible.

(prog (x y)
 0 (setq x 0)
 1 (setq y 0)
 2 (do-something-with x y)
 3 (cond
    ((< (incf y) 10) (go 2))
    ((< (incf x) 10) (go 1))))

  It is sometimes exceptionally useful to be able to build things
  from such basic building blocks, however.
  
-- 
Erik Naggum, Oslo, Norway

Act from reason, and failure makes you rethink and study harder.
Act from faith, and failure makes you blame someone and push harder.