[HARLEQUIN][Common Lisp HyperSpec (TM)] [Previous][Up][Next]


Macro MULTIPLE-VALUE-SETQ

Syntax:

multiple-value-setq vars form => result

Arguments and Values:

vars---a list of symbols that are either variable names or names of symbol macros.

form---a form.

result---The primary value returned by the form.

Description:

multiple-value-setq assigns values to vars.

The form is evaluated, and each var is assigned to the corresponding value returned by that form. If there are more vars than values returned, nil is assigned to the extra vars. If there are more values than vars, the extra values are discarded.

If any var is the name of a symbol macro, then it is assigned as if by setf. Specifically,

 (multiple-value-setq (symbol1 ... symboln) value-producing-form)
is defined to always behave in the same way as

 (values (setf (values symbol1 ... symboln) value-producing-form))
in order that the rules for order of evaluation and side-effects be consistent with those used by setf. See Section 5.1.2.3 (VALUES Forms as Places).

Examples:

 (multiple-value-setq (quotient remainder) (truncate 3.2 2)) =>  1
 quotient =>  1
 remainder =>  1.2
 (multiple-value-setq (a b c) (values 1 2)) =>  1
 a =>  1
 b =>  2
 c =>  NIL
 (multiple-value-setq (a b) (values 4 5 6)) =>  4
 a =>  4
 b =>  5

Side Effects: None.

Affected By: None.

Exceptional Situations: None.

See Also:

setq, symbol-macrolet

Notes: None.


The following X3J13 cleanup issues, not part of the specification, apply to this section:


[Starting Points][Contents][Index][Symbols][Glossary][Issues]
Copyright 1996, The Harlequin Group Limited. All Rights Reserved.