[plt-scheme] Multiple values
On Tue, 2006-02-21 at 00:03 -0600, Robby Findler wrote:
. . .
> Also, it my taste that a list should represent things where the number
> of elements varies. That is, I like to try to use cons and null when my
> function consumes/produces arbitrary values of this shape (in HtDP
> terms):
>
> a list-of-X is either
> - null
> - (cons X list-of-X)
>
> instead of values where you know how many pairs there are going to be,
> always. In those cases, I find a struct works better (or, were I
> programming in ML, a tuple).
I tend to agree. I have a convention of using improper lists when I
think "tuple", and leave proper lists for variable-length sequences.
So multiple-value are really only a little more than an efficiency hack
(as Lauri Alanko said)?
-- Bill Wood