[previous] [up] [next]     [contents] [index]
Next: Library Functions Up: Evaluation Previous: Tail Evaluation

Multiple Values

A primitive procedure can return multiple values by returning the result of calling scheme_values. The functions scheme_eval_compiled_multi, scheme_apply_multi, _scheme_eval_compiled_multi, and _scheme_apply_multi potentially return multiple values; all other evaluation and applications procedures return a single value or raise an exception.

Multiple return values are repsented by the scheme_multiple_values ``value''. This quasi-value has the type Scheme_Object *, but it is not a pointer or a fixnum. When the result of an evaluation or application is scheme_multiple_values, the number of actual values can be obtained as scheme_multiple_count and the array of Scheme_Object * values as scheme_multiple_array. If any application or evaluation procedure is called, the scheme_multiple_count and scheme_multiple_array variables may be modifies, but the array previously referenced by scheme_multiple_array is never re-used and should never be modified.

The scheme_multiple_count and scheme_multiple_array variables only contain meaningful values when scheme_multiple_values is returned.



PLT