## 11 Iteration and Tests

Macro: DO-EXTERNAL-SYMBOLS

  Package:LISP

  Syntax:

      (do-external-symbols (var [package [result-form]])
                {decl}* {tag | statement}*)

  Executes STATEMENTs once for each external symbol in the PACKAGE (which defaults to the current package), with VAR bound to the current symbol. Then evaluates RESULT-FORM (which defaults to NIL) and returns the value(s).

Special Form: DO*

  Package:LISP

  Syntax:

      (do* ({(var [init [step]])}*) (endtest {result}*)
                {decl}* {tag | statement}*)

  Just like DO, but performs variable bindings and assignments in serial, just like LET* and SETQ do.

Macro: DO-ALL-SYMBOLS

  Package:LISP

  Syntax:

      (do-all-symbols (var [result-form]) {decl}* {tag | statement}*)

  Executes STATEMENTs once for each symbol in each package, with VAR bound to the current symbol. Then evaluates RESULT-FORM (which defaults to NIL) and returns the value(s).

Function: YES-OR-NO-P (&optional (format-string nil) &rest args)

  Package:LISP

  Asks the user a question whose answer is either ’YES’ or ’NO’. If FORMAT- STRING is non-NIL, then FRESH-LINE operation is performed, a message is printed as if FORMAT-STRING and ARGs were given to FORMAT, and then a prompt "(Yes or No)" is printed. Otherwise, no prompt will appear.

Function: MAPHASH #'hash-table

  Package:LISP

  For each entry in HASH-TABLE, calls FUNCTION on the key and value of the entry; returns NIL.

Function: MAPCAR (fun list &rest more-lists)

  Package:LISP

  Applies FUN to successive cars of LISTs and returns the results as a list.

Special Form: DOLIST

  Package:LISP

  Syntax:

      (dolist (var listform [result]) {decl}* {tag | statement}*)

  Executes STATEMENTs, with VAR bound to each member of the list value of LISTFORM. Then returns the value(s) of RESULT (which defaults to NIL).

Function: EQ (x y)

  Package:LISP

  Returns T if X and Y are the same identical object; NIL otherwise.

Function: EQUALP (x y)

  Package:LISP

  Returns T if X and Y are EQUAL, if they are characters and satisfy CHAR-EQUAL, if they are numbers and have the same numerical value, or if they have components that are all EQUALP. Returns NIL otherwise.

Function: EQUAL (x y)

  Package:LISP

  Returns T if X and Y are EQL or if they are of the same type and corresponding components are EQUAL. Returns NIL otherwise. Strings and bit-vectors are EQUAL if they are the same length and have identical components. Other arrays must be EQ to be EQUAL.

Macro: DO-SYMBOLS

  Package:LISP

  Syntax:

      (do-symbols (var [package [result-form]]) {decl}* {tag |
      statement}*)

  Executes STATEMENTs once for each symbol in the PACKAGE (which defaults to the current package), with VAR bound to the current symbol. Then evaluates RESULT-FORM (which defaults to NIL) and returns the value(s).

Special Form: LOOP

  Package:LISP

  Syntax:

      (loop {form}*)

  Executes FORMs repeatedly until exited by a THROW or RETURN. The FORMs are surrounded by an implicit NIL block.