Nyquist / XLISP 2.0 -
Contents |
Tutorials |
Examples |
Reference
cl:multiple-value-prog1
The cl:multiple-value-prog1 macro is like
prog1, but it can handle multiple
values:
- (cl:multiple-value-prog1 expr1 [expr2 ...])
- exprN - arbitrary Lisp expressions
returns - the values returned by the first expression
(defmacro cl:multiple-value-prog1 (expr &rest body)
(setq cl:*multiple-values* nil)
(let* ((result (eval expr)))
(if cl:*multiple-values*
`(progn ,@body
(setq *rslt* ',*rslt*
cl:*multiple-values* t)
',result)
`(progn ,@body ',result))))
The cl:multiple-value-prog1 macro evaluates the first
expression and saves all the values returned by the evaluation. It
then evaluates each of the following expressions from left to right,
discarding their values. After the evaluation is finished, the
cl:*multiple-values*
and *rslt* variables are
restored and the primary value from evaluating the fist expression is
returned.
The
cl:*multiple-values*
variable is T
if evaluating the first expression returns multiple values and
NIL with a normal return value.
Back to top
Nyquist / XLISP 2.0 -
Contents |
Tutorials |
Examples |
Reference