[plt-scheme] match question
On Mon, May 12, 2008 at 11:34 PM, praimon <praimon at gmail.com> wrote:
> thanks for your response. Would you say that the greediness of
> the patterns produces counter-intuitive answers?
> Here's a very simple example:
>
> (match '(3 2 4 3 2 1)
> ((list x y ... x z ...) (append y z)))
> => (2 4 3 2)
>
> Surely the result should be (2 4 2 1)? At least that's the intuitively
> correct answer (and the one returned by Mathematica, e.g.).
>
> Changing ... to ..1 produces a different counter-intuitive answer: (2 4 3 1).
> For people like me, who are merely using your language rather than trying
> to understand its inner workings, this is worrisome.
Neither of those are the right answer. There seems to be something
wrong with non-linear patterns (patterns where a variable appears
multiple times, like `x' does here) combined with ... I'll take a
look at it.
If you could file a bug report with that example (see the "Submit Bug
Report" entry under the Help menu) that would be great.
Thanks,
--
sam th
samth at ccs.neu.edu