Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Clean (programming language)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Comparison to Haskell== The syntax of Clean is very similar to that of Haskell, with some notable differences. In general, Haskell has introduced more [[syntactic sugar]] than Clean:<ref name="CleanHaskellGuide" /> {| class="wikitable" border="1" |- ! Haskell ! Clean ! Remarks |- | <syntaxhighlight lang="haskell">[ x | x <- [1..10] , isOdd x]</syntaxhighlight> | <syntaxhighlight lang="clean">[ x \\ x <- [1..10] | isOdd x]</syntaxhighlight> | [[list comprehension]] |- | <syntaxhighlight lang="haskell">x:xs</syntaxhighlight> | <syntaxhighlight lang="clean">[x:xs]</syntaxhighlight> | [[cons]] operator |- | <syntaxhighlight lang="haskell"> data Tree a = Empty | Node (Tree a) a (Tree a) </syntaxhighlight> | <syntaxhighlight lang="clean"> :: Tree a = Empty | Node (Tree a) a (Tree a) </syntaxhighlight> | [[algebraic data type]] |- | <syntaxhighlight lang="haskell">(Eq a, Eq b) => ...</syntaxhighlight> | <syntaxhighlight lang="clean">... | Eq a & Eq b</syntaxhighlight> | class assertions and contexts |- | <syntaxhighlight lang="haskell">fun t@(Node l x r) = ...</syntaxhighlight> | <syntaxhighlight lang="clean">fun t=:(Node l x r) = ...</syntaxhighlight> | as-patterns |- | <syntaxhighlight lang="haskell">if x > 10 then 10 else x</syntaxhighlight> | <syntaxhighlight lang="clean">if (x > 10) 10 x</syntaxhighlight> | if |}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)