4.7 Loop Facility ================= A common complaint with Lisp’s traditional looping constructs was that they were either too simple and limited, such as ‘dotimes’ or ‘while’, or too unreadable and obscure, like Common Lisp’s ‘do’ loop. To remedy this, Common Lisp added a construct called the “Loop Facility” or “‘loop’ macro”, with an easy-to-use but very powerful and expressive syntax.
· Loop Basics The ‘cl-loop’ macro, basic clause structure. · Loop Examples Working examples of the ‘cl-loop’ macro. · For Clauses Clauses introduced by ‘for’ or ‘as’. · Iteration Clauses ‘repeat’, ‘while’, ‘thereis’, etc. · Accumulation Clauses ‘collect’, ‘sum’, ‘maximize’, etc. · Other Clauses ‘with’, ‘if’, ‘initially’, ‘finally’.