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

From: Jens Axel Søgaard (jensaxel at soegaard.net)
Date: Sun Jan 5 10:39:42 EST 2003

Hi all

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

Note, the following works as expected.

  > (match (list 1 2)
      [(or (a 2)) a])

Jens Axel Søgaard

Posted on the users mailing list.