On 16-2-2013 18:23, bearophile wrote:
The version you have put in Rosettacode is good, I have just added some missing tests at the beginning of the UTM constructor.
I added that precondition reluctantly, that's why its short :-). I really feel that input validation should be done elsewhere. I was thinking about adding a factory method to the UTM that accepts a string array, parses and validates it, and returns a fully initialized immutable TuringMachine. It would still be a lot of ugly code though. That stronger typing can reduce the need for input checking is something I find interesting. I'll have a look at the Ada code.
(but we have also to benchmark if this doesn't decrease the program performance for a successive bigger Busy Beaver machine):
On the other hand, if we have stronger typing we may not have to do the rather expensive checks that are currently in the loop.