[r6rs-discuss] Scheme pattern matching & R*RS
John Cowan
cowan at mercury.ccil.org
Tue Dec 14 13:42:11 EST 2010
Per Bothner scripsit:
> I.e. where (var1 var2 var3) is a valid pattern matching a 3-element list.
> This syntax for patterns has the advantage that it is a generalization of
> syntax-rules patterns, in addition to being natural and compact.
Ah, I see. I think that the natural extension of define is to allow it
to define a single named pattern-matching procedure rather than allowing
it to define multiple names simultaneously.
> In that case, how do you distinguish:
>
> (define (function-name param1 param2) <expression>)
>
> from
>
> (define (var1 var2 var3) <expression>)
The former is the only meaning, but with pattern-matching define
you may also write (define (foo (v1 v2) v3) ...) to define
a procedure which accepts two arguments, the first of which is a
two-element list.
--
John Cowan cowan at ccil.org
"Not to know The Smiths is not to know K.X.U." --K.X.U.
More information about the r6rs-discuss
mailing list