The dolist macro (a standard macro in Common Lisp) repeats its code for each element of a list. Its format is:
         (dolist ( var lst result ) code )
The variable var is boundefined inside the dolist. The value of var is set to successive cars of the list lst and the code is executed for each member of the list lst.
If lst is (), the code is not executed. The value of dolist is result, which is optional; if there is no result, the value is #f.
(define (sum-list lst) (let ((sum 0)) (dolist (x lst sum) (set! sum (+ sum x)) ) ))> (sum-list '(1 4 5 7)) 17
Contents    Page-10    Prev    Next    Page+10    Index