Live data from Hacker News

Show HN: Clojure by Example

kimh.github.io

31–37 of 37 posts

Re: Show HN: Clojure by Example

#31

Clojure has always been slightly disappointing for me... The principles behind its design are all sound and Rich Hickey deserves credit for putting in the hard thought behind it. ... but.... the reality seems to be of a really under performing language. The forums are consistently full of people with 'why is this slow?' to which the solution is always 'Give it more hints' or 'do it in a more Java like way'. Unfortuna…

In my experience, Clojure performs rather well. I used to use Python for what I now use Clojure and it seems to outperform that.

Sure, Java and C++ perform better still. I don't feel like Clojure is trying to compete with them on performance, rather Clojure is competing with the dynamic languages and allows you to drop down to lower levels (type hints, Java interop) when you do need more performance. Developer productivity first, performance second.

If I need C++ performance, then I use C++ because few languages can compete with that, but for most of my work (web development), I don't need to.

Re: Show HN: Clojure by Example

#32

This is a great project! I believe there's a lack of clarity in the let form explanation: =>(let [object "light"] => (let [object "darkness"]) => (println (str "God said let there be " object))) God said let there be light nil 'object' is overwritten but only within the second let form: =>(let [object "light"] => (let [object "darkness"] => (println (str "God said let there be " object)))) God said let there be darkn…

Thanks for your feedback! I think I could make it better.

http://kimh.github.io/clojure-by-example/#scope

Re: Show HN: Clojure by Example

#33

Earlier quoted context omitted.

Unfortunately the Clojure stack seems not to have much mechanical sympathy (despite its best intentions). It seems the natural/idiomatic way to use Clojure results in far too much dynamic behavior to be performant. Clojure may scale well, but its inherent bad performance (without lots of work) is a major downside. This is simply untrue for most applications. I've been using Clojure and ClojureScript in production for…

>> For applications where you need performance like native Java, then sure, you need to optimize--add type hinting, use Java's mutable data structures, and more. I can't say too much about it because I'm not an expert on optimizing Clojure for high performance--I don't have to be. This is what I'm talking about. Performance-wise, Clojure is all about scaling, not absolute performance. From my point of view (lots of l…

From my point of view (lots of low-level, embedded, real-time,DSP,C,C++, etc). I personally get appalled at the performance that is left on the table when using idiomatic Clojure (and even Java)

Okay, but that's a very different statement than your initial post where you wrote "the reality seems to be of a really under performing language." The value proposition for Clojure includes well thought-out high level abstractions, great built-in immutable data structures, interoperability with Java and JavaScript, all the stuff that comes with being homoiconic, and more. The value proposition for Clojure does not include programming for embedded systems, building low-level systems software, or wringing out every last bit of performance from your hardware. "Inherent bad performance," as you put it previously, is relative to the problem space you are working in.

Re: Show HN: Clojure by Example

#34
post #32

This is a great project! I believe there's a lack of clarity in the let form explanation: =>(let [object "light"] => (let [object "darkness"]) => (println (str "God said let there be " object))) God said let there be light nil 'object' is overwritten but only within the second let form: =>(let [object "light"] => (let [object "darkness"] => (println (str "God said let there be " object)))) God said let there be darkn…

Thanks for your feedback! I think I could make it better. http://kimh.github.io/clojure-by-example/#scope

Thank you!

I agree with fnordsensei's comment about ordering. You might also think about including this example from the docs which demonstrates bindings are immediately available:

    (let [x 1
          y x]
      y)
    -> 1

Re: Show HN: Clojure by Example

#35

Earlier quoted context omitted.

>> For applications where you need performance like native Java, then sure, you need to optimize--add type hinting, use Java's mutable data structures, and more. I can't say too much about it because I'm not an expert on optimizing Clojure for high performance--I don't have to be. This is what I'm talking about. Performance-wise, Clojure is all about scaling, not absolute performance. From my point of view (lots of l…

From my point of view (lots of low-level, embedded, real-time,DSP,C,C++, etc). I personally get appalled at the performance that is left on the table when using idiomatic Clojure (and even Java) Okay, but that's a very different statement than your initial post where you wrote "the reality seems to be of a really under performing language." The value proposition for Clojure includes well thought-out high level abstra…

its not a different statement, Clojure is (partially) sold as a performant language, partially thru its links to Java, partially because of 'scaling' I suppose. What I'm saying is that it isn't truly performant.

Like you say, the strong points of Clojure are the homoiconicity, immutability, STM etc. It seems to me that as soon as you attempt to use the good bits of Clojure, performance goes out of the window, which is a real shame.

BTW: I wasn't indicating I thought Clojure was intended for embedded s/w, just indicating that I have an interest in true performance, not just scalability due to my background in embedded s/w.

Don't get me wrong, I like Clojure and it has its place, but its just a shame that in order to use its strengths, you pay a big price.

Re: Show HN: Clojure by Example

#36

Clojure has always been slightly disappointing for me... The principles behind its design are all sound and Rich Hickey deserves credit for putting in the hard thought behind it. ... but.... the reality seems to be of a really under performing language. The forums are consistently full of people with 'why is this slow?' to which the solution is always 'Give it more hints' or 'do it in a more Java like way'. Unfortuna…

I aggree. I love the language and concepts, but at some point, after two months of learning it, I've got fed up with the slugishness of the whole thing and gave up because I have no idea what to do with it. I also found it a very difficult language to learn. I felt like I was taking baby steps every day, although I was giving it all I could. I felt stupid and frustrated to the point that I'm actually considering quit…

To really feel the difference you have to work on complex logic.

It's easy to be under illusion that you can create everything using a verbose language. At some point the complex system you work on just gets extremely hard to reason about.

For verbose languages you reach this point considerably faster.

Re: Show HN: Clojure by Example

#37

This is a great project! I believe there's a lack of clarity in the let form explanation: =>(let [object "light"] => (let [object "darkness"]) => (println (str "God said let there be " object))) God said let there be light nil 'object' is overwritten but only within the second let form: =>(let [object "light"] => (let [object "darkness"] => (println (str "God said let there be " object)))) God said let there be darkn…

This would be better for illustrating that object is not overweritten, I think: =>(let [object "light"] => (let [object "darkness"] => (println (str "God said let there be " object))) => (println (str "God said let there be " object))) God said let there be darkness God said let there be light nil

Thanks for this. I added your example with slightly different form!
Post reply on HN