@node Iteration and Tests, User Interface, Structures, Top
@chapter Iteration and Tests

@deffn {Macro} DO-EXTERNAL-SYMBOLS 
Package:LISP

Syntax:
@example
(do-external-symbols (var [package [result-form]])
          @{decl@}* @{tag | statement@}*)
@end example

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).


@end deffn

@deffn {Special Form} DO* 
Package:LISP

Syntax:
@example
(do* (@{(var [init [step]])@}*) (endtest @{result@}*)
          @{decl@}* @{tag | statement@}*)
@end example

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


@end deffn

@deffn {Macro} DO-ALL-SYMBOLS 
Package:LISP

Syntax:
@example
(do-all-symbols (var [result-form]) @{decl@}* @{tag | statement@}*)
@end example

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).


@end deffn

@defun 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.


@end defun

@defun MAPHASH #'hash-table
Package:LISP

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


@end defun

@defun MAPCAR (fun list &rest more-lists)
Package:LISP

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


@end defun

@deffn {Special Form} DOLIST 
Package:LISP

Syntax:
@example
(dolist (var listform [result]) @{decl@}* @{tag | statement@}*)
@end example

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).


@end deffn

@defun EQ (x y)
Package:LISP

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


@end defun

@defun 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.


@end defun

@defun 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.


@end defun

@deffn {Macro} DO-SYMBOLS 
Package:LISP

Syntax:
@example
(do-symbols (var [package [result-form]]) @{decl@}* @{tag |
statement@}*)
@end example

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).


@end deffn

@deffn {Special Form} LOOP 
Package:LISP

Syntax:
@example
(loop @{form@}*)
@end example

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


@end deffn
