Thanks, Danny. This fix seems fine if you're willing to dial up to #lang 
racket, but I'm interested in doing this in *SL, for my students (for whom 
syntactic consistency is desirable and very important). I suppose I could build 
my own variant of 2htdp/image which includes the require you give here, and 
have them require that.

Cheers - Adam

On Aug 29, 2012, at 1:08 PM, Danny Yoo wrote:

>> This came up perhaps a year ago; I'm writing about pattern matching with the
>> color struct that comes with 2htdp/image. It is inconsistent with struct
>> matching generally.
>> 
>> In the following excerpt, bar and baz are fine, but foo (commented out)
>> causes an error (match: color does not refer to a structure definition):
> 
> 
> Although it doesn't appear to be documented, the color structure can
> be found in mrlib/image-core.  So you can do this:
> 
> ;;;;;;;;;;
> #lang racket
> (require (except-in 2htdp/image color)
>         (only-in mrlib/image-core color))
> 
> (match (make-color 3 4 5)
>  ([struct color (r g b a)]
>   'ok))
> ;;;;;;;;;;
> 
> 
> I think part of what was interfering with what you were doing earlier
> is that the 'color' structure isn't exposed as a structure in
> 2htdp/image, but instead is exposed as a HTDP-level primitive.
> 
> Good luck!
> 


____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to