Per Bothner <[email protected]> writes: > Regardless: > > (lambda > (<pat> <body> <body> ...) > (<pat> <body> <body> ...) > ...) > > is incompatible with core:lambda - i.e. it is not a super-set of traditional > lambda, and it's not just a matter of rare corner cases. That makes it > unacceptable, IMO.
You're right.
The existing pattern matching libraries I'd looked at all made the
distinction between match-lambda, good for creating a single-argument
function which destructures that argument, and match-lambda*, which
creates a multi-argument function which takes those arguments as a list
and destructures that list.
I think this has to do with the development history of the original
Wright pattern-matching library, and in any case is indeed not very well
suited to renaming either as the core lambda form.
I'd like to propose the following revision: do away with the
one-argument special case currently known as match-lambda (this can be
easily implemented in terms of the multi-argument case, and make the
pattern matching version of lambda take one pattern and any number of
body statements, for compatibility with core lambda:
(lambda <pat> <body>) ==>
(core:lambda x (match x (<pat> <body> ...)))
and then use case-lambda from (rnrs control) for the multi-pattern case:
(case-lambda (<pat> <body>) ...) ==>
(control:case-lambda x (match x
(<pat> <body>)
...))
Thoughts?
--
Jim Wise
[email protected]
pgpTuN4aMSV2W.pgp
Description: PGP signature
_______________________________________________ r6rs-discuss mailing list [email protected] http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss
