File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Compare Clojure to Haskell and CL

 
Igor Mechnikov
Ranch Hand
Posts: 100
Chrome Linux VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Amit Rathore
author
Greenhorn
Posts: 20
Clojure
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 100
Chrome Linux VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Amit Rathore wrote:safe from multithreading issues


Does CL lack something as far as concurrency and multithreading compared to CLojure?
 
Amit Rathore
author
Greenhorn
Posts: 20
Clojure
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic