Clean has several advantages as a programming language. It features a uniqueness type system, which allows a purely functional way of dealing with resources such as I/O that cannot be duplicated. Clean also has a list comprehension system which can create queries at least as complex as SQL can handle. Clean also uses a more compact format for conditionals. Clean has a very simple and easy-to-use IDE that writes only the project files, not the actual programs. Clean programs are extremely portable; in almost all cases, porting to a different platform simply means a recompile.
The hello world program for Clean is shown below:
module helloThe first line,
Start :: String Start = "Hello, world!"
module hello, tells the compiler that that this module, or part of a project, is called "hello". It has to be stored in a file called hello.icl unless you want to change that line of code. The next line,
Start :: String, says that the variable
Start, which is the first thing the compiler evaluates, is of the
Stringtype. The last line sets the variable
Startto "Hello, world!". Since no other output method, such as a GUI, is declared, the words "Hello, world!" just appear in a console box.
Clean is based on the mathematical principle of graph rewriting. Arrays and other constants are graphs, and functions are graph rewriting formulas. Clean programs are evaluated using the well-understood technique of reduction, which essentially reduces everything to a very simple form. Reduction makes programs implemented in Clean relatively fast, even with the high abstraction of the language.
Clean has a very unique compiling system. First, source files (.icl) and project files (.dcl) are converted into Clean's own bytecode (.abc files). This is implemented in C and Clean . The bytecode is completely platform-independent, but it cannot be run. Next, this bytecode is converted to object code (.obj) using C. After that, the object code is linked with other files in the module and the runtime system and converted into a normal executable (done in Clean). Although it seems like there would be bootstrapping issues with this, they are resolved because earlier versions of the Clean system were written completely in C.
Clean was produced and is mantained by the University of Nijmegen. The IDE was written by the Dutch-based company Hilt. It is available for the platforms Windows, Macintosh, Solaris, and Linux, but input-output capabilities are limited on Linux. It is licensed under the GNU LGPL, but it can be used without the LGPL if it is bought for €495. Clean is not developed with an open source development model, though.
Although Clean isn't used much commercially, it is used extensively in research.