1.1 About the Loop Facility
do. The Loop Facility provides clauses that control iteration behavior in different ways. For example, you can iterate until the end test evaluates to
nilby using the loop construct
while, and you can iterate until the end test has a non-
nilvalue by using the loop construct
domacro terminates when the result of its end test is non-
Some iteration operations occur frequently in Common Lisp code; for instance, you often need to sum values, iterate through a list, collect items into a list, or find a maximum or minimum value. The Loop Facility provides support for these common operations with such constructs as
do macro provides no such support for these operations; you must code the desired functionality into the loop explicitly.
The Loop Facility also provides predefined extensions for iteration over commonly used data structures. For example, you can iterate over items in a hash table or over characters in a string.
However, you can achieve the same iteration results from the
do macro that you can with the Loop Facility. The following examples illustrate the programming differences.
Generated with Harlequin WebMaker