Structural Informatics Group (SIG) logo
Home | Projects | Demos | Downloads | Publications | Local Info | About Us | New site
Go to the first, previous, next, last section, table of contents.

Looping Constructs

(loop <expr>...)  BASIC LOOPING FORM
    <expr>      the body of the loop
    returns     never returns (must use non-local exit)
(do (<binding>...) (<texpr> <rexpr>...) <expr>...)
(do* (<binding>...) (<texpr> <rexpr>...) <expr>...)
    <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> is the initial value of the symbol
                        <step> is a step expression
    <texpr>     termination expression -- iteration ends when it is non-NIL
    <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
(dolist (<sym> <expr> [<rexpr>]) <expr>...)  LOOP THROUGH A LIST
    <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)
(dotimes (<sym> <expr> [<rexpr>]) <expr>...)  LOOP FROM ZERO TO N-1
    <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)

Go to the first, previous, next, last section, table of contents.