Life: A CLEAN Programming Tutorial and Case Study

This WWW tutorial presents a tutorial for the CLEAN Functional Programming Language (Version 0.8.4), in the form of a stepwise development of two programs for animating Conway's Game of Life. Figure 7 shows the second program, which demonstrates the power of the novel and elegant input/output and Graphical User Interface (GUI) facilities of CLEAN, and contains most of the features required in useful applications software. Suggestions on suitable programming style are also included.

This tutorial is based on the paper The Game of Life: A CLEAN Programming Tutorial and Case Study by Anthony Dekker which appeared in ACM SIGPLAN Notices, Volume 29, No. 9, September 1994 (pages 91-104) and as Technical Report TRB5/94, Department of ISCS, National University of Singapore, May 1994.

A Macintosh SEA/HQX file (110K) or a Unix tar file (80K) containing the tutorial in the form of literate LaTeX/CLEAN programs are also available by emailing

UPDATE: See also my Windows Vista Gadget for the Game of Life [11k] or this paper for some theoretical issues involved in the Game of Life, or, of course, the Wikipedia article on the Game of Life.

The Tutorial

  1. Introduction
  2. Why Program in CLEAN?
  3. Some Miscellaneous Functions
  4. Representing Patterns for the Game of Life
  5. A Simple CLEAN Program
  6. File Input and Output for the Game of Life
  7. A File Conversion Program
  8. A GUI-Based Conversion Program
  9. An Abstract Data Type for Animating the Game of Life
  10. An Animation Program
  11. Some Useful GUI Operations
  12. A User-Defined Control
  13. The Final GUI Animation Program
  14. Conclusion