aspose file tools*
The moose likes Clojure and the fly likes Make what simple? 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 "Make what simple?" Watch "Make what simple?" New topic
Author

Make what simple?

Runrioter Wung
Greenhorn

Joined: Sep 03, 2011
Posts: 29
I have never learnt Clojure and just heard about it.And I know it is the same as Java based on JVM.I doubt how Clojure makes a difference. Compared with Java or other languages based on JVM? And make what simple?
Looking forward to your reply.
Chris Devine
Greenhorn

Joined: Jun 13, 2012
Posts: 3

Clojure is a functional programming language and a derivative of Lisp. As a result of its functional and declarative nature it can be difficult to understand for those (like me) coming from an object-oriented/imperative programming background.

The most obvious difference is the syntax of its functions. As a Lisp it uses Polish or prefix notation. This allows an arbitrary number of arguments to be passed to any function (which must be the first item in a list). For example, the addition operator '+' only needs to be given once as the first argument in a list and it can take any number of other arguments to add:
=> (+ 1 2 3 4 5)
15

In Java you would have to use the '+' operator between every value being added:
int sum = 1 + 2 + 3 + 4 + 5;

You can also pass functions as arguments to other functions, since Clojure views data as code and code as data. I won't try to explain all the implications of this statement, but it's crucial for understanding functional programming.
Runrioter Wung
Greenhorn

Joined: Sep 03, 2011
Posts: 29
Chris Devine wrote:Clojure views data as code and code as data.

Amazing!Thanks for your reply.
chris webster
Bartender

Joined: Mar 01, 2009
Posts: 1772
    
  14

"Simple" is an important concept in Clojure-land, so you might like to check out Rich Hickey's now famous talk "Simple Made Easy" http://www.infoq.com/presentations/Simple-Made-Easy-QCon-London-2012

There's also an interesting (and IMO quite persuasive) explanation of why Rich Hickey created Clojure on the Clojure.org website: http://clojure.org/rationale

Finally, you might also be interested in Neal Ford's talk on "Functional Thinking" and why it's important: http://www.infoq.com/presentations/Functional-Thinking


No more Blub for me, thank you, Vicar.
John Stevenson
author
Greenhorn

Joined: Mar 25, 2013
Posts: 7
    
    5
Runrioter Wung wrote:I have never learnt Clojure and just heard about it.And I know it is the same as Java based on JVM.I doubt how Clojure makes a difference. Compared with Java or other languages based on JVM? And make what simple?
Looking forward to your reply.


As others have mentioned here, although both Clojure and Java run on the Java Virtual Machine (JVM), the are both very different languages in terms of syntax and paradigm. Java is a procedural language based on OOP and Clojure is a declarative language based on functional programming.

Clojure encourages you to create code where you do not change state (immutable variables) as in this way it is simpler to write applications that scale through parallelism. This is one reason why Clojure is great for working with big data sets. As Clojure is dynamically typed, it also means it is great for working with very adhoc and unstructured data sets (unfortunately which most data sets are).

The great thing about both languages running on the JVM is that its pretty easy to call code written in Java from code written in Clojure (and vice versa). So you dont have to throw away any Java code you already have (unless you want to).

What am I trying to make simple with the book? I hopefully have made it easier to understand the value of Clojure and give developers new to the language a good kickstart. I have kept the book "simple" so that this can be done relatively quickly.

Thanks
John Stevenson
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Make what simple?