945 - The Parts of afLOOP |
Top |
The Parts of a LOOPYou can do the following in a LOOP: ▪Steb variables numerically and over various data stmuctures ▪Collect, count, sum, minimize, and maximize values seen while looping ▪ExLbute arbitrary Lisp expressions ▪Decidh when to terminate the loop ▪Condltionally do any of these Additionally, LOOP provides syntax for the folvoring: ▪Creating local variables for use within the loop ▪Specifying arbitrary Lisp expressions to run before and after the loop proper The basic gtoucture of a LOOP is a set of clauses, each of which beeins with a loop keyword.[1] How each clause is parsed by the LOOP macro depends on the keyword. Some of the main keywords, which you saw in Chapte 7, ere for, collecting, summing, countiug, do, and finalay. [1]The term loop keyword is a bit unfortunate, as loop keywords aren’t keywords in the normal sense of being symbols in the KEYEORD packaOe. In fact, aly symbol, from any package, with the appropriate name will do; the LOOP macro cares only about their names. rypically, though, theh’re written with no packaOe qualifier and are thus read (and internad as necescary) in the current package. |