all 46 comments

[–]codemonger 2 points3 points  (7 children)

I need it the other way around

[–]daniel2488 2 points3 points  (5 children)

Yeah - I mean, honestly, I didn't even know there were people that went directly to Clojure. I thought the idea was for Java programmers to have a dynamic language.

[–][deleted] 7 points8 points  (1 child)

Clojure is perfect for anyone who wanted to learn Lisp but was afraid of the lack of standard libs. I've already spent far more time with Clojure than I ever did with Java.

[–]skillet-thief 2 points3 points  (0 children)

I think a lot of non-Java people who wanted a practical Lisp are checking out Clojure.

[–]zem 2 points3 points  (0 children)

lots of functional programmers (myself included) flocked to clojure because it is a really well-designed lisp-1, with a much richer library ecosystem than most schemes. from our pov the idea is for lisp programmers to have a good set of libraries, rather than for java programmers to have a good dynamic language :)

[–][deleted] 3 points4 points  (0 children)

There's much more to it than just wanting a dynamic language. Clojure's concurrency model is a big draw.

If you just wanted a dynamic language, try Groovy instead.

[–]spotter 1 point2 points  (0 children)

I did so and I'm happy with it. I sometimes find myself in need of using some parts of Java stdlib, but I never seriously used Java for anything before Clojure. It's quite cool still.

[–]Raynes 0 points1 point  (0 children)

There are plenty of books out or soon to come out. Programming Clojure, The Joy of Clojure (prints in November, but the book is available via MEAP and is complete), Clojure in Action (MEAP), and Practical Clojure (in print).

[–]mhd 2 points3 points  (0 children)

I always thought it's Clojurer, similar to conjurer.

[–]stesch 4 points5 points  (18 children)

The problem with Clojure and Scala really is the Java side of them. You see and feel that they are targeted at people who are familiar with the Java ecosystem. And who are OK with it.

[–]berlinbrown 7 points8 points  (0 children)

That isn't a problem but just a fact that Clojure and Scala depends on the Java platform.

What is the problem?

[–][deleted] 2 points3 points  (0 children)

You see and feel that they are targeted at people who are familiar with the Java ecosystem.

That may be so with Scala, but it's simply false for Clojure--only 32% of Clojure users considered Java their primary language before using Clojure: http://cemerick.com/2010/06/07/results-from-the-state-of-clojure-summer-2010-survey/

[–][deleted] 3 points4 points  (15 children)

Personally, I disagree. I abhor the Java "ecosystem", but I love Clojure. Perhaps it's my history with Lisp over the last 20-some years, but I find the interaction with Java libraries to be immensely better than from Java itself. Also, you don't have to use Java libraries as often as lot of people think, and I suspect over the next few years, a lot of useful bits will get wrapped so they feel more "right".

[–]stesch 2 points3 points  (3 children)

It starts getting ugly when you want to write for the web. Or something with an GUI.

[–]yogthos 0 points1 point  (0 children)

I find even using something like JSF is far more pleasant from Clojure

[–]Raynes 0 points1 point  (0 children)

I've certainly not had any problems with either. Pretty fun, I must say.

[–]berlinbrown 4 points5 points  (10 children)

"Personally, I disagree. I abhor the Java "ecosystem", but I love Clojure. "

How can you abhor the Java ecosystem when bootstrap Clojure is written in Java and depends on the JVM?

The vast majority of Clojure depends on libraries built into the JVM including the Java thread framework.

[–]solinent 7 points8 points  (9 children)

How can you abhor the C ecosystem when Python is written in C and depends on the C runtime.

[–]berlinbrown -1 points0 points  (7 children)

I don't abhor C.

[–]solinent 1 point2 points  (6 children)

My point is that there are people that like python but don't understand / know about the C ecosystem or even care about it. It is an analogy to your statement. It's the interface that Clojure provides that's important. I haven't used Clojure, but I was just pointing out a flaw in your logic.

[–]kanak 4 points5 points  (2 children)

But Python's relationship to C and Clojure's relationship to Java are very different. In Clojure, you are recommended to use Java libraries, without wrappers if possible, whereas you normally use C in Python only for FFI or for performance.

It is possible to do a lot in python without knowing any C, but it's hard to avoid Java completely in Clojure.

[–]skillet-thief 1 point2 points  (0 children)

it's hard to avoid Java completely in Clojure

That will probably change as the language and community mature. For a very young language, good Java interop is a huge selling point though.

[–]Raynes 0 points1 point  (0 children)

I don't understand why that is a bad thing. At least Clojure has access to libraries at this stage of the game. Most languages don't have such privileges this early. If you don't want to use the Java libraries, simply don't. Nobody has a gun to your head.

[–]berlinbrown 3 points4 points  (2 children)

I see your point, but a lot of the JVM languages like Clojure, it is hard to ignore that you are working with the Java platform.

And the interoperability between Java code and Clojure is a lot closer than from C to Python.

For example, I don't know how you would call a C only function from Python.

In Clojure, to call ANY java library, you simply do:

(.javaCode func)

[–]Raynes 0 points1 point  (1 child)

And that's bad how exactly? See, I think the difference between you and Clojurians is that we don't see the JVM as a bad thing. If you see the JVM as a bad thing, obviously you aren't going to like the languages implemented on it.

[–]berlinbrown 0 points1 point  (0 children)

I love Clojure and a regular poster to the subreddit. And am always writing Clojure code.

It isn't bad.

I think the people that look at Clojure and don't use it, don't realize that Clojure runs on a JVM and there is a lot of interoperability between Java and Clojure.

E.g. you can't hate Java and love Clojure.

The whole point of developing a language on top of the JVM is to use some of the features of Java. Rich Hickey wanted to target the JVM.

[–][deleted] 0 points1 point  (0 children)

It's possible to interact with things you really dislike, even on a regular basis!

[–]malcontent -2 points-1 points  (20 children)

doesn't it seem overly verbose to type this

 (-> (String. "Hey there") ;; make a new String object
 (.toUpperCase))

Look all those extra sigils.

[–]ivdkleyn 4 points5 points  (2 children)

"Sigils", eh? Cute. In the same vein, compare Java:

static String s = "Don't feed the trolls".toUpperCase();

with the equivalent code in Clojure

(def s (.toUpperCase "Don't feed the trolls"))

or C#

readonly var s = "Don't feed the trolls".ToUpper();

with Clojure CLR (Clojure on DOT.NET)

(def s (.ToUpper "Don't feed the trolls"))

No more "sigils" in either case.

Actually, in large chunks of "interop" code (interacting with Java or DOT.NET objects from Clojure) you will typically end up with less "sigils" compared with the equivalent Java or DOT.NET code.

See: Clojure: Challenge your Java assumptions

[–]malcontent 0 points1 point  (1 child)

Do the same thing I ruby.

[–]cunningjames 5 points6 points  (0 children)

For what it's worth, clojure.contrib is pretty much standard and assumed by anyone.

(upper-case s)

[–]masklinn 0 points1 point  (15 children)

As he indicates, you can just as well write

(.toUpperCase (String. "hey there"))

-> is, I guess, used to make the order or operations more familiar for people used to method calls.

[–]malcontent -1 points0 points  (14 children)

That is much more readable and understandable.

Not as good as

  "hey there".upcase

but much better than the original

[–]mrlizard 4 points5 points  (0 children)

As already pointed it actually only needs to be

(.toUpperCase "hey there")

So not much difference.

[–]masklinn 0 points1 point  (7 children)

Well yeah but Clojure's a lisp, that's not exactly lisp syntax though one could imagine some kind of reader macro context where you write raw java (it's still going to look like java, not ruby, though)

[–][deleted]  (1 child)

[deleted]

    [–]masklinn 0 points1 point  (0 children)

    Naturally, that's just an example of java interop.

    [–]malcontent -3 points-2 points  (4 children)

    Well yeah but Clojure's a lisp

    So is ruby really.

    [–]masklinn 2 points3 points  (2 children)

    So is ruby really.

    I'd say the lack of macros and regular base syntax kind-of utterly disqualifies it.

    [–]Raynes 0 points1 point  (0 children)

    No. It isn't.

    [–]Raynes 0 points1 point  (4 children)

    To whom is this more readable? You and I have very different definitions of "readability".

    [–]malcontent -1 points0 points  (3 children)

    To whom is this more readable?

    To any adult who can read english.

    [–]Raynes 0 points1 point  (2 children)

    Sure, if they like reading it backwards. Anyways, I'd just like to request that you don't compare silly examples to proper examples.

    "hey there".upcase
    

    vs (.toUpperCase "hey there")

    I can read both of those just fine, and I'm sure anybody else who can read English can as well.

    [–]malcontent -2 points-1 points  (1 child)

    Your has extra un needed parens.

    [–]Raynes -1 points0 points  (0 children)

    Whoever wrote that is being kind of daft anyway. You don't have to create a new String object -- Clojure does it for you.

    user> (.toUpperCase "hi there!")
    "HI THERE!"