aspose file tools*
The moose likes Clojure and the fly likes Compare Clojure to Haskell and CL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Languages » Clojure
Bookmark "Compare Clojure to Haskell and CL" Watch "Compare Clojure to Haskell and CL" New topic
Author

Compare Clojure to Haskell and CL

Igor Mechnikov
Ranch Hand

Joined: Feb 13, 2011
Posts: 100

Greetings,
I've been thumbing through Land of Lisp and Learn yourself a Haskell with great interest.
In what situations would those languages hold an edge over Clojure and vice-versa?


String knock = "\u042F \u0418\u0433\u043e\u0440\u044c";
Amit Rathore
author
Greenhorn

Joined: May 08, 2011
Posts: 20

Clojure's design draws heaviliy from several amazing languages - haskell, ocaml, erlang, common lisp, scheme, etc.

I haven't personally used Haskell in any real project, so I can't comment directly. However, I do believe that Clojure's macro system has advantages that other languages don't have, and can't provide in the same easy way.

What I mean by that is that in Clojure, being a LISP, building mini-languages (DSLs) on top of the core is a natural design pattern. There is language-level support for this, with the macro system. Also, being functional in nature, designing systems in a bottom-up manner is far more natural and results in more expressive and elegant code.

Further, Clojure has explicit support for state-management (safe from multithreading issues). These constructs are much easier to understand and use than, say monads in Haskell.
Igor Mechnikov
Ranch Hand

Joined: Feb 13, 2011
Posts: 100

Amit Rathore wrote:safe from multithreading issues


Does CL lack something as far as concurrency and multithreading compared to CLojure?
Amit Rathore
author
Greenhorn

Joined: May 08, 2011
Posts: 20

Well, for one thing, all core data-structures in Clojure are immutable, which is not true of CL.

Further, Clojure has a built-in STM system which allow for safe state management (be it of a single thing at a time or for multiple things in a coordinated transaction). This doesn't exist in CL, unless you use one of several STM libraries out there. Even then, it isn't automatic, and requires careful discipline from the programmer.

Clojure was designed from ground-up to support safe multithreading.
 
Consider Paul's rocket mass heater.
 
subject: Compare Clojure to Haskell and CL