> I wish that I had known about rackunit earlier. What other > 'adult' features of Racket should people would you recommend to > readers of HtDP?
When you think of objects in the Java or C++ sense, there are two concepts there that are mixed together: interfaces and inheritance. Racket's structure properties gets us interfaces, and they are definitely not taught in an intro class. If we want to have a general interface to poke a value, we can do so: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; #lang racket (define-values (prop:poke pokeable? pokeable-procedure) (make-struct-type-property 'poke)) (define (poke! thing) (cond [(pokeable? thing) ((pokeable-procedure thing) thing)] [else (error 'poke! "Don't know how to poke ~e" thing)])) (struct mascot () #:property prop:poke (lambda (self) (printf "Ho ho!\n"))) (define pillsbury-dough-boy (mascot)) (poke! pillsbury-dough-boy) (struct cartoon-character (name) #:property prop:poke (lambda (self) (printf "~a: that tickles!\n" (cartoon-character-name self)))) (define homer (cartoon-character "Homer")) (poke! homer) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; There are a few structure property types that are built-into Racket, to customize the way that values print as strings, to make a structure look like a function, etc. ____________________ Racket Users list: http://lists.racket-lang.org/users