The reader turns the 'a into (quote a), so you'd actually also get the 'x1-case given 'quote. I don't think this case is a bug so much as a "gotcha." -Ian ----- Original Message ----- From: "Jon Zeppieri" <zeppi...@gmail.com> To: "Kieron Hardy" <kieron.ha...@gmail.com> Cc: "users" <users@racket-lang.org> Sent: Monday, September 17, 2012 7:11:03 PM GMT -05:00 US/Canada Eastern Subject: Re: [racket] Problem with case
The fact that the first one works at all should probably be considered a bug. The syntax of case here: http://docs.racket-lang.org/reference/case.html?q=case#(form._((lib._racket/private/more-scheme..rkt)._case)) dictates that the constants in a case clause be parenthesized. The more important issue, however, is that the constants are implicitly quoted by the case form. So, when you explicitly quote them, they're double quoted. You're trying to match 'a against ''a. -Jon On Mon, Sep 17, 2012 at 6:47 PM, Kieron Hardy < kieron.ha...@gmail.com > wrote: Hi all, Can anyone explain why the first function below selects 'x1-case as expected but the second fails to select 'x2-case? Am I expecting something to happen that shouldn't? Thanks, Kieron. **** #lang racket (case 'a ['a 'x1-case] ['b 'x1-case] [(15 2 3) 'y1-case] [(10 11 12) 'z1-case]) (case 'a [('a 'b) 'x2-case] [(15 2 3) 'y2-case] [(10 11 12) 'z2-case]) ____________________ Racket Users list: http://lists.racket-lang.org/users ____________________ Racket Users list: http://lists.racket-lang.org/users ____________________ Racket Users list: http://lists.racket-lang.org/users