2. Why Program in CLEAN?

Much has been written about the benefits of programming in a modern functional programming language. The use of a more powerful and concise notation allows shorter and more maintainable programs to be written than is the case for an imperative language. Compile-time type-checking in a functional language detects many more errors than for an imperative language, since omission of a subexpression is a type error, whereas omission of a command is not. Polymorphic typing allows generic functions to be written, and these can be re-used without alteration. Functional languages permit arguments to functions to be any kind of value, including other functions, thus allowing a wider range of generic functions. For example, a generic list sorting function would take as an argument the kind of comparison operator to be used, so that it could apply to every kind of list.

The CLEAN language is one of the first functional languages suitable for practical application programming. The compiler generates efficient code, so that the speed of CLEAN programs, though usually slower than C, is of the same order of magnitude. Real numbers are handled efficiently, and there is an elegant unique type mechanism for incorporating update-in-place file operations in a purely functional context. CLEAN has a module structure which allows large applications to be developed. Testing of functions is made easier by the provision of a kind of module which evaluates and prints expressions of arbitrary type. Finally, and perhaps most importantly, there is a large library of Graphical User Interface (GUI) facilities which allow useful applications to be developed for the Macintosh and X-windows environments. The same program will run in both environments (with slightly different look and feel for predefined GUI facilities). Windows, menus, dialog-boxes and their components are first-class objects of various predefined types, and so can be manipulated easily using functions. The equivalent of methods in object-oriented programming is obtained by including state-transition functions as components of these objects. The programming style required is novel, and thus requires some practice, but is much easier than X or Motif programming with an imperative language. Development of the CLEAN system is still in progress, so that further improvements in efficiency and usability can be expected.

UpTop Level


ForwardSome Miscellaneous Functions