Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Clean - The Functional Programming Language
Index -> Programming, General Programming -> Functional Programming
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
haskell




PostPosted: Mon Apr 02, 2007 1:26 pm   Post subject: Clean - The Functional Programming Language

From http://clean.cs.ru.nl/About_Clean/Clean_Language_Features/clean_language_features.html
Quote:

A Functional Programming Language like Clean is based on the concept of mathematical functions. Clean is a pure functional language, there is not such a thing as an assignment. This has a big advantage: a function cannot have a side-effect. A Clean function is referential transparent: the result of a function only depends on the value of the function arguments and on nothing else.

This has important consequences:
o Once a function is working, it will always work. A function will always react in the same way, regardless when and in which context the function is used;
o One can reason about
Clean functions and the Clean program as a whole (which is a function application) by using traditional mathematical reasoning: uniform substitution and mathematical induction.

For making real world applications one needs of course to be able to update a database, perform I/O, update an array destructively, pass a message to another program. And, the application should run efficiently enough. Although Clean does not have assignments, objects can be updated destructively. Clean is the only functional language in the world which has a special type system, uniqueness typing. This type system is developed in Nijmegen. It enables to update function arguments destructively retaining the purity of the language.

Research Concepts Used in Clean

The Software Technology Research Group is working on functional languages since 1984. Many new concepts which are now commonly used in the functional language community have been introduced by our group (such as term graph rewriting, lazy copying, abstract reduction, uniqueness typing , Clean's Object I/O concept , concurrent and parallel aspects of Clean, dynamic typing) have a look at our research pages and download our papers.

Feature List of the Clean Language

For people who are familiar with other functional languages, such as Haskell, we give here a short list with the features of the language. For more information on the language, look here.
o Clean
o is a lazy, pure, higher order functional programming language with explicit graph rewriting semantics; one can explicitly define the sharing of structures (cyclic structures as well) in the language; Although
o Clean is by default a lazy language one can smoothly turn it into a strict language to obtain optimal time/space behavior: functions can be defined lazy as well as (partially) strict in their arguments; any (recursive) data structure can be defined lazy as well as (partially) strict in any of its arguments; Clean
is a strongly typed language based on an extension of the well-known Milner / Hindley / Mycroft type inferencing/checking scheme (Milner 1978; Hindley 1969; Mycroft 1984) including the common higher order types, polymorphic types, abstract types, algebraic types, synonym types and existentially quantified types;
o Due to the strong typing of Clean and the obligation to initialize all objects being created run-time errors can only occur in a very limited number of cases: when partial functions are called with arguments out of their domain (e.g. dividing by zero), when arrays are accessed with indices out-of-range and when not enough memory (either heap or stack space) is assigned to a Clean application; Type classes
o and type constructor classes are provided to make overloaded use of functions and operators possible; Clean
o offers the following predefined types: integers, reals, Booleans, characters, strings, lists, tuples, records, (destructively updateable) arrays and files; Clean
o has pattern matching, guards, list comprehensions and array comprehensions and a lay-out sensitive mode; One can define functions on a local level using
o where blocks, let expressions (even before a guard) and strict let expressions; Clean's
o key feature is a polymorphic uniqueness type inferencing system, a special extension of the Milner / Hindley / Mycroft type inferencing/checking system allowing a refined control over the single threaded use of objects; with this uniqueness type system one can influence the time and space behavior of programs; it can be used to incorporate destructive updates of objects within a pure functional framework, it allows destructive transformation of state information, it enables efficient interfacing to the non-functional world (to C but also to I/O systems like X-Windows) offering direct access to file systems and operating systems; Clean
o is a modular language allowing separate compilation of modules; one defines implementation modules and definition modules; there is a facility to implicitly and explicitly import definitions from other modules; Clean
o offers a sophisticated I/O library with which window based interactive applications (and the handling of menus, dialogues, windows, mouse, keyboard, timers and events raised by sub-applications) can be specified compactly and elegantly on a very high level of abstraction; GUI-based programs
o written in Clean using the 0.8 I/O library can be ported without modification of source code to anyone of the many platforms we support. There are many libraries available offering additional functionality.


Clean is highly optimized, much faster than other language in the functional realm, and many in the imperative realm as well:
- Clean vs. GCC
- Clean vs. G++
- Clean vs. Haskell
- Clean vs. Scheme
- Clean vs. Scala
- Clean vs. OCaml

If you love Haskell and would like to get Clean-style optimizations, than Hacle and Haskell-Clean might be of interest to you.

Learning Clean is free as well:
- Clean Book
- Object I/O Tutorial
- Functional Programming and Parallel Graph Rewriting

Clean code bears a strong resemblance to Haskell:

clean:
fac n
 | n==0 = 1
 | n>0 = n * fac (n-1)


clean:
power :: Int Int -> Int
power x 0 = 1
power x n = x * power x (n-1)

Start :: Int
Start = power (3+4) 2


If you want a highly optimized functional programming language that can be used in a huge variety of areas, than try Clean.

http://clean.cs.ru.nl/index.html
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, General Programming -> Functional Programming
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 1 Posts ]
Jump to:   


Style:  
Search: