I prefer Clojure over all the other Lisps I've tried, but YMMV.
I prefer Clojure over all the other Lisps I've tried, but YMMV.
Hope Clojure doesn't push the FP thing too far. Pure functional languages are evil. In broad sense, pure anything in evil. Look what Java turned into trying to be a pure (or too much of an) object oriented language.
It’s multi paradigm that wins. Giving programmers freedom on how he wants to code any specific set of problem.
Package p = java.lang;
Class x = p.String;
x y = "Hello";
Method z = y.substring;
w = z(0, 5);Of course, primitives are not objects, but autoboxing helps.
http://clojure.org/multimethods
The integration with Java is almost seamless, so of course you can also use Java-style OOP if you're feeling masochistic :-P
Clojure is definitely not pushing FP too hard. It was designed to be especially supportive of FP, but it is definitely a multi-paradigm language.
It seems to me a way to sneak statements into the language. Or does lisp have something like that as well?
I'm just surprised that (it seems) you can do statement-based code in lisp. I thought it all had to be expressions. This feels like cheating. BTW: I can see that progn/do syntactically produce expressions, but the value of all but the last one are thrown away - similar to python in that respect. This seems against the spirit of expressions.
This is a common misconception. You are thinking of pure functional programming, not Lisp. Certainly a lot of Lisp programmers, myself included, prefer functional programming. Scheme, especially, leans toward functional programming. Haskell, not Lisp, is rightly known for embracing functional to the exclusion of all other paradigms.
What really stands out about Lisp is support for ALL paradigms, even those that haven't yet been invented. Lisp is an extensible language, that can be changed to fit your needs. Features that would require language extensions in other programming languages can be implemented as ordinary libraries in Lisp. Lisp was the language that allowed experimentation with new paradigms like functional programming, object-oriented programming, and logic programming long before more specialized languages (Haskell, Smalltalk, Prolog) were created to provide specific support for these paradigms.
Of course you can do statement-based code, like in any language that supports I/O(Haskell included).
That's a hard fact and it isn't what functional programming is about.
It is my first contact with FP, but what I find incredibly cool is the way the data structures are transparently persistent. If it's true this is a rarity in functional languages, I can't imagine using another one.
Let's say you have a map, and you change a value in it. Being a functional programming language, and the map being an immutable structure, you end up with two maps: the old and the new. Now, the cool part is every data-structure in clojure is designed _not_ to do this by copying the whole thing. You'll have two maps who share everything except the changed value. Same with collections, sets, trees etc. The work under the hood must be impressive...
Another nice thing (for me at least, coming from imperative programming) is there is a better difference between a variable and a value. A variable is a placeholder, and a value is ... well, a value. In clojure you treat them separately. A better explanation: http://clojure.org/state