enum weekdays is cycle <Sun Mon Tue Wed Thu Fri Sat>
So that Sat++ eqv Sun (and a resumable control exception is thrown so
that you can do something fancy whenever you return to the start of
the cycle)?
Likewise, how would one be able to legally say:
enum seasons <spring summer autumn|fall winter>
That is, to use a junction in the definition in order to provide
synonyms for one of the enumerated values?
--
Jonathan "Dataweaver" Lang
> Some (many?) enumerations represent cycles, where incrementing from
> the last element takes you back to the first: the seasons, the months,
> the days of the week, the hues, etc. How hard would it be to write a
> module that lets you say something like:
>
> enum weekdays is cycle <Sun Mon Tue Wed Thu Fri Sat>
>
> So that Sat++ eqv Sun (and a resumable control exception is thrown so
> that you can do something fancy whenever you return to the start of
> the cycle)?
Another way of looking at that enum is as a simple state machine.
More complex state machines would be nice too. That is all :)
--
Andy Armstrong, hexten.net