Clean (programming language)

Clean is a functional programming language.

Clean characterized by referential transparency, which means that the result of a function call is dependent only on the input parameters. With the same input parameters is thus obtained always the same result.

Clean has properties similar to the Haskell programming language. The most striking difference is the use of uniqueness typing for input and output instead of a monad.

Examples

Modules hi     Start = "Hello world! " Faculty ( Mathematics ):

Modules factorial     fak 0 = 1   fak fak n = n * ( n-1)     / / Calculate the value of 10 faculty   Start = 10 fak Fibonacci sequence:

Module fibonacci     fib 0 = 0   fib 1 = 1   fib n = fib ( n - 2 ) fib ( n - 1 )     / / Calculate the value of the seventh Fibonacci number   Start = fib 7 Infix notation:

(^) Infixr 8 :: Int Int -> Int   (^) X 0 = 1   (^) X n = x * x ^ ( n-1) The given type declaration defines the function (^) as a right -associative infix operator with priority 8 This means that x * x ^ (n-1 ) is equivalent to x, * (x ^ ( n -1)), and not to (x * x) ^ (n- 1). The (^ ) operator is predefined in the Clean - standard environment.

Quicksort

Sort modules      qsort :: [ a] -> [ a] | Ord a    qsort [ ] = []    qsort [a: xs ] = qsort [x \ \ x <- xs | x = a]      / / Sort list    Start = qsort [ 5,4,3,2,1 ] Web Links

  • Internet presence of Clean ( English)
  • Functional programming
193280
de