[plt-scheme] Multiple values
On Mon, 2006-02-20 at 22:21 -0700, Richard Cleis wrote:
. . .
> This is the answer I am waiting for; I've been tossing in solutions
> that don't require multiple-values, hoping that someone will hammer me
> with a killer counter example. I use multiple-values with functions
> like udp-receive! because that's what is provided, but I don't see why
> it's any better than a list of '(n ip port). I barely remember
> generating multiple-values during some state-vector processing a while
> back, but I can't recall if they provided a better solution than lists
> would have anyway.
My question stems from a questionable experience with multiple-values in
Common Lisp (which are similar to R5RS). I was developing a
recursive-descent parser, and I chose to have the function for each
non-terminal take a token list and return two values -- the structure
built for the non-terminal's right-hand-side and the list of remaining
tokens. I found the resulting program unpleasant, not at all elegant.
Of course, I can't say how much was my problem and how much was the
choice of mechanism :-). Still, since then I've been dubious about
multiple-values.
-- Bill Wood