Perhaps there is another way. In what way should your state rings be different from rings?
> --
> You received this message because you are subscribed to the Google Groups "Macaulay2" group.
> To post to this group, send email to maca...@googlegroups.com.
> To unsubscribe from this group, send email to macaulay2+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/macaulay2?hl=en.
So far I think my StateRings will just be rings with extra hash keys. For example I will write things like
R.cards = {2,2,3}
to install a list of "state cardinalities" associated with the ring. I was thinking I might eventually write a distribution package for manipulating such rings, and would like to have it carefully typed, but it's not strictly necessary at the moment... so far any method that requires the StateRing structure will just return an "error: key not found in hash table".
> ... is it possible to simply change the type of a ring R, without changing anything else about it? Is there a big hash table somewhere like TYPE where I can do
>
> TYPE.R = StateRing
>
> ?
>
No, there's nothing like that.
>
> On Sun, Dec 18, 2011 at 11:55 AM, Andrew Critch <cri...@gmail.com> wrote:
> So far I think my StateRings will just be rings with extra hash keys. For example I will write things like
>
> R.cards = {2,2,3}
>
> to install a list of "state cardinalities" associated with the ring. I was thinking I might eventually write a distribution package for manipulating such rings, and would like to have it carefully typed, but it's not strictly necessary at the moment... so far any method that requires the StateRing structure will just return an "error: key not found in hash table".
>
Perhaps it will suffice for your purposes just to add keys (or better, a single key, such as StateRing) to "R", as you suggest, and not to try to introduce a new subtype. If not, let us know. A better error message would be "expected ring to be a state ring", by the way, and you could implement that by testing for the presence of the key before using it.