Home Previous Up Next Table of Contents Index
  6.1 The LOOP Facility   6.1.2 Variable Initialization and Stepping Clauses   6.1.2.1 Iteration Control   6.1.2.1.3 The for-as-on-list subclause

6.1.2.1.3.1 Examples of for-as-on-list subclause

;; Collect successive tails of a list.
 (loop for sublist on '(a b c d)
       collect sublist)
 ((A B C D) (B C D) (C D) (D))
 
;; Print a list by using destructuring with the loop keyword ON.
 (loop for (item) on '(1 2 3)
       do (print item))
1 
2 
3 
  NIL
 

Home Previous Up Next Table of Contents Index
© Franz Inc. 1998-2002 - File last updated 6-21-2002