[plt-scheme] associating data with structure types
You can add properties to structure types. That sounds like what you
need. You cannot use define-struct, tho. You have to use the
make-struct-type interface.
Robby
At Fri, 19 Mar 2004 15:00:53 -0500, "Neil W. Van Dyke" wrote:
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
> I want to associate at least one piece of data with each subtype of a
> particular structure type. In this particular case, the data is
> constant, and is known at the time the structure subtype is defined.
>
> One way to do this would be with a hashtable keyed on the structure type
> object. But I'd prefer to encapsulate the data within the structure
> type object itself, rather than maintain a homomorphic structure.
>
> Is there a "user data" field in the structure type info (alongside the
> constructor, predicate, etc. info) that could be used for this? I
> couldn't find reference to such a thing in the documentation.
>
> Alternatively, for my current problem, an older MzScheme wishlist item
> -- user-definable print and write methods for structure types -- would
> work.
>
> --
> http://www.neilvandyke.org/