Next: Functions as Objects, Previous: Functional Programming, Up: Welcome to Lisp [Contents][Index]
When you want to do something repeatedly, it is sometimes more natural to use iteration than recursion. A typical case for iteration is to generate some sort of table. This function:
(defun show-squares (start end) (do ((i start (+ i 1))) ((> i end) 'done) (format t "~A ~A~%" i (* i i))))
prints out the squares of the integers from start
to end
.