[plt-scheme] Multiple values

From: Adam Wick (awick at cs.utah.edu)
Date: Tue Feb 21 14:20:43 EST 2006

On Feb 21, 2006, at 8:49 AM, Robby Findler wrote:
> They introduce a lot of new errors that were not there before.
> ...
> Anyways, Adam's certainly right that you can avoid allocation, but  
> many
> of the other arguments for multiple values seem to apply equally well
> to using `match' and some kind of a record or tuple.

I find this argument kind of a non-starter. After all, you can get  
rid of a
frequent set of error checks by forcing functions to always take one
argument, and then using 'match' and some kind of a record or tuple.
In Scheme, at least, the only difference between allowing multiple
arguments and only allowing a single argument is a heap allocation
and some error checks.

John's argument about map (and fold, and (grrr) parser productions)  
makes
a bit more sense to me. To be honest, however, I actually like the  
fact that
map fails with multiple values, because it makes me think about whether
or not I really want to map. I do wish fold and, again, parser  
productions
allowed multiple value returns, though. But I'd argue that these are  
stylistic
choices; John finds returning vectors more useful and/or elegant, I  
prefer
returning multiple values.



-Adam


Posted on the users mailing list.