[plt-scheme] The or-pattern in match.ss

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sun Jan 5 18:45:14 EST 2003

At Sun, 5 Jan 2003 16:39:42 +0100, Jens_Axel_Søgaard wrote:
> I have become quite fond of the pattern matching facilities in match.ss.
> Today I tried using the or-pattern, but can't make it work.
> The simplest example that doesn't work is
>   > (match (list 1 2)
>       [(or (a 2)
>            (1 a)) a])
>   match: variables of or-pattern differ in in: (or (a 2) (1 a))
> I was expecting the result to 1. Is this a bug, or have I missed something
> obvious?
> Note, the following works as expected.
>   > (match (list 1 2)
>       [(or (a 2)) a])
>   1

Our `match' implementation is in shambles. The current implementation
is based on a `defmacro'-oriented expansion of Andrew Wright's code,
hacked repeatedly as MzScheme has evolved. No test suite to speak of.

Someone should probably start over with Andrew's source. Any

(The slightly interesting part is making it work nicely with
`define-struct'. I could probably find time to do that myself, if
someone else does the rest of the work. Or I would be happy to merely
offer advice.)

Meanwhile, the short answer is that you've no doubt found a bug and
I'll look into fixing it as soon as I can.


Posted on the users mailing list.