Chap 7: Iteration on Numbers and Lists

Do's: Dotimes, Dolist, Do

DOTIMES

	  n
	m

Interesting - count parameter is not in body in this example

DOLIST

(counts : simpler to use COUNT-IF)

Whenever a

(RETURN <expression>) is encountered in a DOLIST or DOTIMES, the expression is evaluated and becomes value of the function call (eg return the first n outlyers)

Typically, the purpose of DO's is for side- effects, not the result

DO is more general
(like do-while...bindings interesting)

LOOP:

the forms in the body are evaluated repeatedly ... until a

(return <expression>) is found

PROG1, PROGN

evaluate a series of forms sequentially but return the value of only one
(rest are evaluated for side-effects only)

DEFUN, LET, LET*, WHEN, and UNLESS do this implicitly (i.e., return last form)

Since the bodies of DEFUN and LETs can contain any number of forms, PROG1 and PROGN are not used much