[gambit-list] define-type

lowly coder lowlycoder at huoyanjinjing.com
Wed May 27 16:44:45 EDT 2009


Cool, thanks!
Another quesiton on define-type -- is there anyway to get back an unique
identifier for the type?

i.e. if I have:

(define f1 (make-foo ..))
(define f2 (make-foo ...))

(define b1 (make-bar ..)))

I want something so that

(equal? (type f1) (type f2)) and
(not (equal? (type f1) (type b1)))

the idea is then, I can do dispatching on types i.e.

(define (draw object)
  ((lookup-in-hash-table (type object)) object))

Thanks!

On Wed, May 27, 2009 at 5:14 AM, David St-Hilaire <sthilaid at iro.umontreal.ca
> wrote:

> lowly coder 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.
>>
> Hi there!
>
> I've put some of Marc's undergrad notes related to define-type in the
> gambit-c wiki a while ago:
>
> http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php/Define-type
>
> Hope it can help!
>
> David
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20090527/211441a8/attachment.htm>


More information about the Gambit-list mailing list