[plt-scheme] Multiple values

From: Bill Wood (william.wood3 at comcast.net)
Date: Mon Feb 20 23:54:00 EST 2006

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?
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




Posted on the users mailing list.