From ... From: Erik Naggum Subject: Re: Printing.. Date: 1999/07/25 Message-ID: <3141909324457850@naggum.no>#1/1 X-Deja-AN: 505011812 References: <379B2FA2.3B1B0FDB@pp.inet.fi> mail-copies-to: never Organization: Naggum Software; +47 8800 8879; http://www.naggum.no Newsgroups: comp.lang.lisp * Anssi Purola | Why this doesn't print numbers from 1 to 100? It only prints '99'. | | (defun loop-function() | ( do ((i 0 (+ i 1))) (>= i 99) (print i))) to make this slightly more readable: (do ((i 0 (+ i 1))) (>= i 99) (print i))) the problem here is that (>= i 99) is a malformed termination clause. somehow, >= as a variable is is true in your image. I suspect that this comes from something you have done previously. if you start up a new image and try to evaluate it again, you will get an error. (if you don't, you have a really weird Lisp environment.) try using ((>= i 99)), instead. the termination clause is a list whose head is a form and whose tail is a body to be evaluated when the form evaluates to true, returning the value of the last form of the body. | And what's right way to print something? | | (setq temp 10) | (print temp) | | It shoul work, but it prints '10' twice. it should print 10 three times: (1) the return value of the SETQ form, (2) the value of TEMP in the PRINT function, and (3) the return value of the PRINT form. this is because your Lisp system does (loop (print (eval (read)))) or something close to it while it reads and evaluates input from you. #:Erik -- suppose we blasted all politicians into space. would the SETI project find even one of them?