On 19 Mar 2007, at 21:31, Jonathan Lang wrote:

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

Reply via email to