ToC DocOverview CGDoc RelNotes Index PermutedIndex
Allegro CL
Home Previous Up Next Table of Contents Index
  ANSI Common Lisp   3 Evaluation and Compilation   3.1 Evaluation

3.1.7 Return Values

Ordinarily the result of calling a function is a single object. Sometimes, however, it is convenient for a function to compute several objects and return them.

In order to receive other than exactly one value from a form, one of several special forms or macros must be used to request those values. If a form produces multiple values which were not requested in this way, then the first value is given to the caller and all others are discarded; if the form produces zero values, then the caller receives nil as a value.

The next figure lists some operators for receiving multiple values2. These operators can be used to specify one or more forms to evaluate and where to put the values returned by those forms.

Some operators applicable to receiving multiple values
multiple-value-bind multiple-value-prog1 return-from
multiple-value-call multiple-value-setq throw
multiple-value-list return

The function values can produce multiple values2. (values) returns zero values; (values form) returns the primary value returned by form; (values form1 form2) returns two values, the primary value of form1 and the primary value of form2; and so on.

See multiple-values-limit and values-list.


Home Previous Up Next Table of Contents Index
© Franz Inc. 1998-2019 - File last updated 02-07-2019