Measures Concepts
GitHub icon

Clean

Clean - Programming language

< >

Clean is a programming language created in 1987.

#237on PLDB 37Years Old 206Repos

Try now: Riju · TIO

Clean is a general-purpose purely functional computer programming language. For much of the language's active development history it was called Concurrent Clean, but this was dropped at some point.. Read more on Wikipedia...


Example from Compiler Explorer:
module example import StdInt square :: Int -> Int square n = n * n Start :: Int Start = square 3
Example from Riju:
module main import StdEnv Start world #(console, world) = stdio world #console = fwrites "Hello, world!\n" console #(ok, world) = fclose console world = world
Example from hello-world:
module hello Start :: {#Char} Start = "Hello World"
// Hello World in Clean module hello Start :: String Start = "Hello World!\n"
Example from Linguist:
definition module GenMap import StdGeneric generic gMap a b :: .a -> .b derive gMap c, UNIT, PAIR, EITHER, CONS, FIELD, OBJECT, {}, {!} derive gMap [], (,), (,,), (,,,), (,,,,), (,,,,,), (,,,,,,), (,,,,,,,)
Example from Wikipedia:
(^) infixr 8 :: Int Int -> Int (^) x 0 = 1 (^) x n = x * x ^ (n-1)
Clean Keywords
case ccall class code code inline derive export foreign generic if in infix infixl infixr instance let of otherwise special stdcall where with

Language features

Feature Supported Token Example
Conditionals ✓
Classes ✓
Strings ✓ "
"Hello world"
Line Comments ✓ //
// A comment
Comments ✓
Semantic Indentation X

View source

- Build the next great programming language · Search · Add Language · Features · Creators · Resources · About · Blog · Acknowledgements · Queries · Stats · Sponsor · Day 605 · feedback@pldb.io · Logout