Subject: Re: Printing..
From: Erik Naggum <>
Date: 1999/07/25
Newsgroups: comp.lang.lisp
Message-ID: <>

* 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.

  suppose we blasted all politicians into space.
  would the SETI project find even one of them?