[racket] match in Advanced Student?

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Mon Oct 31 22:45:25 EDT 2011

Oh, I see why. 'color' is bound using define-primitive in order to
cooperate with the beginner language (and so that 'color' can be a
constructor). But doing that interferes with the usual information
bound by a struct that match picks up.

I'm not sure what the right way to resolve this is.

Robby

On Mon, Oct 31, 2011 at 9:39 PM, Robby Findler
<robby at eecs.northwestern.edu> wrote:
> Is make-color coming from 2htdp/image? I see that's not working (not
> sure why yet).
>
> Robby
>
> On Mon, Oct 31, 2011 at 9:34 PM, Adam Shaw <adamshaw at cs.uchicago.edu> wrote:
>> Thanks! That still doesn't work for color:
>>   match: color does not refer to a structure definition
>> although it does work with my own custom color struct:
>> (define-struct clr (r g b))
>> (match (make-clr 1 2 3)
>>   [(struct clr (r g b)) (* r g b)])
>>   - Adam
>> On Oct 31, 2011, at 9:26 PM, Jay McCarthy wrote:
>>
>> One of the branches of the pattern language is
>>
>> | (struct id (pattern ...))
>>
>> Your pattern should be
>>
>> (struct color (r g b))
>>
>>
>> _________________________________________________
>>  For list-related administrative tasks:
>>  http://lists.racket-lang.org/listinfo/users
>>
>



Posted on the users mailing list.