[plt-scheme] Why multiple values?

From: Carl Eastlund (cce at ccs.neu.edu)
Date: Sun Dec 24 17:25:21 EST 2006

On 12/24/06, Corey Sweeney <corey.sweeney at gmail.com> wrote:
>
> And the rest prefer not to construct an arbitrary, irrelevant syntax so they
> use lists ;)
>
> But I do see your point.  I can now see why some people are using
> multi-value's.  But I would argue that it should be a compiler thing, not a
> syntax thing.

Scheme has multiple inputs without resorting to lists (for functions
of fixed input size), so having the same thing for outputs isn't
really arbitrary or irrelevant.  Lists (linear, arbitrary-size,
usually homogenous data structures), on the other hand, are not a
close fit (for flat, fixed-size, often heterogenous function outputs).

Anyway, this isn't (just) an efficiency issue.  It's a matter of what
the programmer can express.  Multiple values says "this program
outputs these two things".  Lists say "this program outputs a list".

Multiple values aren't my favorite program construct either, but I
think we've covered the ground of why they exist as they are.

-- 
Carl Eastlund


Posted on the users mailing list.