Chris Marusich <cmmarus...@gmail.com> writes:
> I've noticed that when one passes multiple values as a single argument
> to a procedure, only the first value gets used.  Is this expected?

Yes.  Scheme has no concept of a "multiple values" object that can be
given a single name, or passed as a single argument to a procedure.
Returning multiple values from a procedure is analogous to passing
multiple arguments to a procedure.

Use 'call-with-values', 'let-values', or 'receive' to call a procedure
that returns multiple values (or no values).

If you do not use one of the above forms (or a macro that expands to one
of them) to call a procedure that returns multiple values, then Guile
will discard all but the first result.  Note that this is a
Guile-specific extension.  Other Scheme implementations may behave
differently (e.g. report an error) if multiple values (or no values) are
returned to a procedure call that was not done using one of the forms
listed above.

      Mark


PS: I should mention that Guile does indeed have a "multiple values"
    object at the C level only, to allow C code to return or accept
    multiple values without uglifying the C calling convention for
    Scheme procedures.  This is to work around the fact that C does not
    support returning multiple values from a function.

Reply via email to