[plt-scheme] Re: match-let bug or feature?

From: Robby Findler (robby at cs.uchicago.edu)
Date: Sat Jan 5 08:13:48 EST 2008

I suspect the only answer is that that should be a syntax error,
instead of a runtime error. In let, you're not allowed to use the same
variable twice and that should probably carry over to match-let. Maybe
you want match-let*?

Robby

On Jan 5, 2008 12:33 AM, Derick Eddington <derick.eddington at gmail.com> wrote:
> I think a more clear example of the problem is:
>
> > (match-let ([(a b) (list 1 2)]
>               [(b a) (list 8 9)])
>     (+ a b))
> match: no matching clause for ((1 2) (8 9))
>
>  === context ===
> /home/d/plt/collects/mzlib/private/match/match-error.ss:9:4: match:error
> /home/d/plt/collects/scheme/private/misc.ss:63:7
>
> Because the patterns (a b) and (b a) get concatenated by the match-let
> macro into ((a b) (b a)) and the values get concatenated into
> ((1 2) (8 9)), and because of match's match-equality-test duplicate
> variable names feature, match is trying to match the second (b a)
> according to what (a b) first matched, and thus the error.
>
> --
> : Derick
> ----------------------------------------------------------------
>
>
>
>
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>


Posted on the users mailing list.