National Institute of Advanced Industrial Science and Technology (AIST) This page is a page of the former research institute. We stopped updating on March 31.2001.
E-mail to webmaster (Japanese) E-mail to webmaster (English)
next up previous contents index
Next: Predicates Up: Control Structures Previous: Blocks and Exits

Iteration

  while test {form}* [special]

  tagbody {tag | statement}* [special]   go tag [special]   prog ({var | (var [init])}*) {tag | statement}* [macro]
  • prog is a macro, which expands as follows:
     (block nil 
        (let var
    	(tagbody
    		tag | statement)))  
    

  do ({(var init [next])}*) (endtest [result]){declare} {form} * [macro]
  • vars are local variables. To each var, init is evaluated in parallel and assigned. Next, endtest is evaluated and if it is true, do returns result (defaulted to NIL). If endtest returns NIL, each form is evaluated sequentially. After the evaluation of forms, next is evaluated and the value is reassigned to each var, and the next iteration starts.
  do* ({var init [next]}*) (endtest [result]){declare} {form}* [macro]
  • do* is same as do except that the evaluation of init and next, and their assignment to var occur sequentially.
  dotimes (var count [result]) {forms}* [macro]
  • evaluates forms count times. count is evaluated only once. In each evaluation, var increments from integer zero to count minus one.
  dolist (var list [result]) {forms}* [macro]
  • Each element of list is sequentially bound to var, and forms are evaluated for each binding. Dolist runs faster than other iteration constructs such as mapcar and recursive functions, since dolist does not have to create a function closure or to apply it, and no new parameter binding is needed.
  until condition {forms}* [macro]
  • evaluates forms until condition holds.
  loop {forms}* [macro]
  • evaluates forms forever. To terminate execution, return-from, throw or go needed to be evaluated in forms.

next up previous contents index
Next: Predicates Up: Control Structures Previous: Blocks and Exits

Hirofumi Nakagaki
Fri Mar 22 12:46:38 JST 1996