sorry for spamming, here's actually what I really want to do (and maybe there's an easier solution than figuring out how define-type works)

I have:

(define-type shape ...)
(define (shape-draw shape) ...)

(define square (make-shape ...))
(define circle (make-shape ...))

Now, I want (square 'draw) to call (shape-draw square) and (circle 'draw) to call (shape-draw circle)

how do I make this link?

thanks!

On Tue, May 26, 2009 at 3:43 PM, lowly coder <lowlycoder@huoyanjinjing.com> wrote:
oh wait, this is in lib/_nonstd.scm, I guess this explains why documentation has been so hard to come by.

can anyone explain how:

(define-prim (##define-type-expand ...) ... in lib/_nostd.scm ) works ?

it seems like an _awful_ lot of code to setup a few macros ... so there must be something magical (optimizations) going on that I'm not aware of.

Thanks!


On Tue, May 26, 2009 at 3:19 PM, lowly coder <lowlycoder@huoyanjinjing.com> wrote:
Hey,

  Where is define-type documented? I can't find it in r5rs or in the gambit documentation (though it is briefly mentioned in a tour of scheme through gambit). define-type is really cool and I'm starting to run against my limited knowledge of it.

Thanks!