Subject: Re: format for list printing
From: Erik Naggum <clerik@naggum.no>
Date: 1997/09/05
Newsgroups: comp.lang.lisp
Message-ID: <3082409059307106@naggum.no>


* sshteingold@cctrading.com
| I stand in awe before the power and convenience (as well as complexity)
| of the CL's format function.

the next step is then to realize its many serious limitations...

    (do ((i 1 (1+ i))
	 (l <list> (cdr list)))
	((endp l))
      (format "~&~D. ~A" i (car l)))

    (loop for elt in <list>
	  for i = 1 then (1+ i)
	  do (format "~&~D. ~A" i elt))

    (let ((i 0))
      (map nil (lambda (elt)
		 (format "~&~D. ~A" (incf i) elt))
	   <list>))

as for vectors (one-dimensional arrays), the changes necessary to the above
code fragments are trivial.  the last form actually works unchanged.

#\Erik
-- 
404 You're better off without that file.  Trust me.