Next: , Previous: , Up: Loop   [Contents][Index]


15.25.3 Parsing Loop Clauses

Clauses

The syntactic parts of a loop construct are called clauses; the scope of each clause is determined by the top-level parsing of that clause’s keyword.

(loop for i from 1 to (compute-top-value)         ;First clause
      while (not (unacceptable i))                ;Second clause
      collect (square i)                          ;Third clause
      do (format t "Working on ~D now" i)         ;Fourth clause
      when (evenp i)                              ;Fifth clause
        do (format t "~D is a non-odd number" i)
      finally (format t "About to exit!"))        ;Sixth clause

Each loop keyword introduces either

The number of forms in a clause is determined by the loop keyword that begins the clause and by the auxiliary keywords (“prepositions”) in the clause.

The keywords

are the only loop keywords that can take any number of Lisp forms and group them as if in a single progn form.

Prepositions or Auxiliary Keywords

Loop clauses can contain auxiliary keywords, which are sometimes called prepositions.


Next: User Extensibility, Previous: How the Loop Facility Works, Up: Loop   [Contents][Index]