[gambit-list] define-type

lowly coder lowlycoder at huoyanjinjing.com
Thu May 28 04:56:33 EDT 2009


It appears ##structure-type is what I want.
Anyone smarter than me want to either:

(1) confirm this is the right answer
or
(2) tell me why using ##structure-type for this purpose is a bad idea?

Thanks!

On Wed, May 27, 2009 at 1:44 PM, lowly coder
<lowlycoder at huoyanjinjing.com>wrote:

> 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://webmail.iro.umontreal.ca/pipermail/gambit-list/attachments/20090528/97d15578/attachment.html 


More information about the Gambit-list mailing list