Nyquist / XLISP 2.0  -  Contents | Tutorials | Examples | Reference

cl:values-list


The cl:values-list function returns the elements of a list unevaluated as multiple values:

(cl:values-list list)
list - a list of values
returns - the elements of the list as multiple values

(defun cl:values-list (list)
  (or (listp list) (error "not a list" list))
  (or (null list) (consp (last list)) (error "not a proper list" list))
  (setq *rslt* list
        cl:*multiple-values* t)
  (first list))

The unevaluated first value from the list is returned as the primary return value, and the list is assigned to the Nyquist *rslt* variable. If an an empty list is given, NIL is returned and the *rslt* variable is set to NIL. An error is signalled if the 'list' argument is not a list or if the list does not end with NIL.

The cl:*multiple-values* variable is set to  T  to indicate that multiple values are returned.

Examples:

(cl:values-list nil)         => NIL  ; *rslt* = NIL
(cl:values-list '(1))        => 1    ; *rslt* = (1)
(cl:values-list '(1 2))      => 1    ; *rslt* = (1 2)
(cl:values-list '(1 2 3))    => 1    ; *rslt* = (1 2 3)
(cl:values-list '(1 2 . 3))  => error: not a proper list - (1 2 . 3)

  Back to top


Nyquist / XLISP 2.0  -  Contents | Tutorials | Examples | Reference