Movatterモバイル変換


[0]ホーム

URL:


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


3.1.7 Return Values

Ordinarily the result of calling afunction is a singleobject. Sometimes, however, it is convenient for a function to compute severalobjects and return them.

In order to receive other than exactly one value from aform, one of severalspecial forms ormacros must be used to request those values. If aform producesmultiple values which were not requested in this way, then the first value is given to the caller and all others are discarded; if theform produces zero values, then the caller receivesnil as a value.

The next figure lists someoperators for receivingmultiple values[2]. Theseoperators can be used to specify one or moreforms toevaluate and where to put thevalues returned by thoseforms.

multiple-value-bindmultiple-value-prog1return-frommultiple-value-callmultiple-value-setqthrowmultiple-value-listreturn

Figure 3-5. Some operators applicable to receiving multiple values

Thefunctionvalues can producemultiple values[2].(values) returns zero values;(valuesform) returns theprimary value returned byform;(valuesform1form2) returns two values, theprimary value ofform1 and theprimary value ofform2; and so on.

Seemultiple-values-limit andvalues-list.


[Starting Points][Contents][Index][Symbols][Glossary][Issues]
Copyright 1996-2005, LispWorks Ltd. All rights reserved.


[8]ページ先頭

©2009-2025 Movatter.jp