[plt-scheme] Multiple values

From: Richard Cleis (rcleis at mac.com)
Date: Tue Feb 21 00:21:34 EST 2006

On Feb 20, 2006, at 9:54 PM, Bill Wood wrote:

> On Mon, 2006-02-20 at 20:22 -0700, Richard Cleis wrote:
>> Don't forget about 'apply'; it can be more readable (and writable) 
>> than
>> call-with-values.
>
> So it appears we have several approaches to an argument-matching
> facility of varying power.  Multiple values doesn't support either
> arbitrarily-long lists of args or any sort of substructure, but is 
> R5RS;
> case-lambda supports the patterns supported by standard lambda-args, 
> but
> is a PLT-specific extension (and using apply gives roughly the same
> power as case-lambda, I think, after not enough time thinking about
> it :-); match.ss supports much more general matching, but is a
> PLT-specific library.  Is there some sort of trade-off between
> portability and expressiveness/power going on here?  It does look like
> lots of people want pattern-matching for Scheme function definitions,
> and are willing to work to get it.  I admit that after doing some ML 
> and
> Haskell programming, I miss pattern-based function definitions, and 
> I've
> been using match.ss more and more.
>
> By the way, is there a SRFI proposal for a matching facility?  I didn't
> see one in the list of SRFI's supported by PLT.
>
> As yet no-one has commented on my original question, which is how
> compelling is the argument for a multiple-values facility in Scheme?

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.

rac

> I'm interested more in the semantics than syntax.  Gregory's comment
> took me somewhat by surprise; I hadn't thought of multiple-values as an
> alternative to pattern matching.
>  -- Bill Wood
>
>
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.