Nyquist / XLISP 2.0 -
Contents |
Tutorials |
Examples |
Reference
cl:multiple-value-list
The cl:multiple-value-list macro evaluates a Lisp
expression and returns all values in a list:
- (cl:multiple-value-list expr)
- expr - an arbitrary Lisp expression
returns - all values in a list
(defmacro cl:multiple-value-list (expr)
(setq cl:*multiple-values* nil)
(let ((result (eval expr)))
(if cl:*multiple-values*
'*rslt*
`(list ,result))))
The cl:multiple-value-list macro first evaluates the
expression. If the evaluation returned multiple values, the
value of the *rslt* variable
is returned, otherwise the normal Lisp return value is returned in a list of
one element.
The
cl:*multiple-values*
variable is T
if evaluating the expression returns multiple values and
NIL with a normal return value.
Examples:
(cl:multiple-value-list 1) => (1) ; cl:*multiple-values* => NIL
; *rslt* => [invalid]
(cl:multiple-value-list
(+ 1 1)) => (2) ; cl:*multiple-values* => NIL
; *rslt* => [invalid]
(cl:multiple-value-list
(cl:values 1 2 3)) => (1 2 3) ; cl:*multiple-values* => T
; *rslt* => (1 2 3)
Back to top
Nyquist / XLISP 2.0 -
Contents |
Tutorials |
Examples |
Reference