CONTROL CONSTRUCTS
EVALUATE CONDITIONALLY
(cond <pair>...)
fsubr
- <pair> pair consisting of:
where
- <pred> is a predicate expression
- <expr> evaluated if the predicate is not NIL
returns the value of the first expression whose predicate is not NIL
THE LOGICAL AND OF A LIST OF EXPRESSIONS
(and <expr>...)
fsubr
- <expr> the expressions to be ANDed
- returns NIL if any expression evaluates to NIL, otherwise the value of the last expression (evaluation of expressions stops after the first expression that evaluates to NIL)
THE LOGICAL OR OF A LIST OF EXPRESSIONS
(or <expr>...)
fsubr
- <expr> the expressions to be ORed
- returns NIL if all expressions evaluate to NIL, otherwise the value of the first non-NIL expression (evaluation of expressions stops after the first expression that does not evaluate to NIL)
EVALUATE EXPRESSIONS CONDITIONALLY
(if <texpr> <expr1> [<expr2>])
fsubr
- <texpr> the test expression
- <expr1> the expression to be evaluated if texpr is non-NIL
- <expr2> the expression to be evaluated if texpr is NIL
- returns the value of the selected expression
EVALUATE ONLY WHEN A CONDITION IS TRUE
(when <texpr> <expr>...)
fsubr
- <texpr> the test expression
- <expr> the expression(s) to be evaluted if texpr is non-NIL
- returns the value of the last expression or NIL
EVALUATE ONLY WHEN A CONDITION IS FALSE
(unless <texpr> <expr>...)
fsubr
- <texpr> the test expression
- <expr> the expression(s) to be evaluated if texpr is NIL
- returns the value of the last expression or NIL
SELECT BY CASE
(case <expr> <case>...[(t <expr>)])
fsubr
- <expr> the selection expression
- <case> pair consisting of:
where:
- <value> is a single expression or a list of expressions (unevaluated)
- <expr> are expressions to execute if the case matches
(t <expr>) default case (no previous matching)
returns the value of the last expression of the matching case
CREATE LOCAL BINDINGS
(let (<binding>...) <expr>...)
LET WITH SEQUENTIAL BINDING
(let* (<binding>...) <expr>...)
fsubr
- <binding> the variable bindings each of which is either:
- 1) a symbol (which is initialized to NIL)
- 2) a list whose car is a symbol and whose cadr is an initialization expression
- <expr> the expressions to be evaluated
- returns the value of the last expression
CREATE LOCAL FUNCTIONS
(flet (<binding>...) <expr>...)
FLET WITH RECURSIVE FUNCTIONS
(labels (<binding>...) <expr>...)
CREATE LOCAL MACROS
(macrolet (<binding>...) <expr>...)
fsubr
- <binding> the function bindings each of which is:
- (<sym> <fargs> <expr>...)
where:
- <sym> the function/macro name
- <fargs> formal argument list (lambda list)
- <expr> expressions constituting the body of the function/macro
<expr> the expressions to be evaluated
returns the value of the last expression
EVALUATE EXPRESSIONS AND CATCH THROWS
(catch <sym> <expr>...)
fsubr
- <sym> the catch tag
- <expr> expressions to evaluate
- returns the value of the last expression or the throw expression
THROW TO A CATCH
(throw <sym> [<expr>])
fsubr
- <sym> the catch tag
- <expr> the value for the catch to return (defaults to NIL)
- returns never returns
PROTECT EVALUATION OF AN EXPRESSION
(unwind-protect <expr> <cexpr>...)
fsubr
- <expr> the expression to protect
- <cexpr> the cleanup expressions
- returns the value of the expression
Note: unwind-protect guarantees to execute the cleanup expressions even if a non-local exit terminates the evaluation of the protected expression
XLISP-PLUS - Version 2.1g - Tom Almy
tom.almy@tek.com - 18 JUL 94
Generated with WebMaker