Using the above modules, we can write our first CLEAN program. The file lifetest.icl contains the program module lifetest :
MODULE lifetest; IMPORT lifepoint;
A program module must contain a rule called Start, the execution of which defines the behaviour of the program. In this case the program calls Step with a list of four points. For modules of this kind, the CLEAN system is able to print out objects of any desired type, which allows for quick testing of modules by evaluating any desired expression.
RULE :: Start -> PntList; Start -> Step [(1,1),(1,2),(1,3),(7,7)];
Execution of this program prints the correct new list of points, and the time taken:
[(0,2),(1,2),(2,2)] Execution: 0.00 Garbage collection: 0.00 Total: 0.00
Representing Patterns for the Game of Life
File Input and Output for the Game of Life