LOOPING CONSTRUCTS
BASIC LOOPING FORM
(loop <expr>...)
fsubr
- <expr> the body of the loop
- returns never returns (must use non-local exit, such as RETURN)
GENERAL LOOPING FORM
(do (<binding>...) (<texpr> <rexpr>...) <expr>...)
(do* (<binding>...) (<texpr> <rexpr>...) <expr>...)
fsubr. do binds simultaneously, do* binds sequentially
- <binding> the variable bindings each of which is either:
- 1) a symbol (which is initialized to NIL)
- 2) a list of the form: (<sym> <init> [<step>])
where:
- <sym> is the symbol to bind
- <init> the initial value of the symbol
- <step> a step expression
<texpr> the termination test expression
<rexpr> result expressions (the default is NIL)
<expr> the body of the loop (treated like an implicit prog)
returns the value of the last result expression
LOOP THROUGH A LIST
(dolist (<sym> <expr> [<rexpr>]) <expr>...)
fsubr
- <sym> the symbol to bind to each list element
- <expr> the list expression
- <rexpr> the result expression (the default is NIL)
- <expr> the body of the loop (treated like an implicit prog)
- returns the result expression
LOOP FROM ZERO TO N-1
(dotimes (<sym> <expr> [<rexpr>]) <expr>...)
fsubr
- <sym> the symbol to bind to each value from 0 to n-1
- <expr> the number of times to loop
- <rexpr> the result expression (the default is NIL)
- <expr> the body of the loop (treated like an implicit prog)
- returns the result expression
XLISP-PLUS - Version 2.1g - Tom Almy
tom.almy@tek.com - 18 JUL 94
Generated with WebMaker