Concurrent Clean

From Wikibooks, open books for an open world
Jump to: navigation, search

Concurrent Clean[edit]

Concurrent Clean is a general-purpose purely functional programming language. This Wikibook is meant to be a companion Part I of Functional Programming in Clean. "Concurrent" refers to Clean's ability to run the same process on several computers, similar to Ada. The language is often just referred to as Clean.

About Clean


1.1 The Language Reference Manual

The language manual can be found at the Documentation page of the Clean website.

Programming in Clean

2.1 Getting Started

The Clean compiler can be found here [1]. Please register, as requested, though it is not necessary (you can click on "Download clean" on the left.) The .7z package is the quickest to download for Windows programming, if you have 7-zip. Then, get Part I of Functional Programming in Clean; get the 1-up PDF version if you plan to study from the computer.

Unzip the package in the directory of choice, and start the Clean IDE. It will ask to integrate into your operating system (basically, being put into the registry so Windows recognizes it exists); click "Yes." To make a "hello world" program, select File->New File and select your file name, in this case "hello.icl". The file name MUST be the same as the module name. Then, type:

module hello

import StdEnv

Start = "Hello, world!"

The name after "module" must even be the same case as the name hello.icl; Clean is case sensitive, i.e. "start =" doesn't work, "while Start =" does. "import StdEnv" loads the standard library, and is required in every Clean program; other libraries can be loaded as well. Both top lines are implied in Clean source code seemingly lacking them. "Start =" defines what is actually executed.

Now a project must be made. Select File->New Project, and name your project hello.prj, only that will work. After that, click on the hello.icl window so that it is active, and select Project->Set Main Module. Now, on the toolbar, select the Update and Run icon (it looks like a window flying to the right.) It will create a DOS terminal with "Hello, world!" displayed. Press any key to exit.

2.2 Answers to Examples in Functional Programming in Clean, Part I