Live data from Hacker News

Why I am excited about Clojure

blog.txus.io

61–70 of 173 posts

Re: Why I am excited about Clojure

#61

> the language tries to drive me to the cleanest solution This is really appealing to me. I've hacked a bit with Ruby (One Month Rails and some other tutorials), but I'm not sophisticated enough to know instinctively how to refactor towards "clean" or "elegant." Most of my code is pretty ugly, and gets uglier the longer I work on it, since when I'm hacking on something without guidance I spend a lot of time just tryi…

Clojure From the Ground Up http://aphyr.com/tags/Clojure-from-the-ground-up is a good resource, and there's also my own Clojure for the Brave and True http://www.braveclojure.com/ . I actually started by going through "Land of Lisp" first. Though it covers common lisp, not Clojure, it's a very fun book.

edit: Realm of Racket is also a good lisp book, and a lot of people like "the little schemer". It's hard for me to say how good these are for people completely new to programming, though.

Finally, there's the ClojureBridge curriculum, which is targeted at new programmers: https://github.com/ClojureBridge/curriculum

Re: Why I am excited about Clojure

#62

I am a Ruby guy torn between diving into Haskell or Clojure. Help! Every time I get excited about one feature of one (ClojureScript) I learn the other has something equivalent or potentially better (Haste). One thing that has put me off on Clojure is 1) the ugly as hell JVM stacktraces, 2) hitting the wall of the number system results in nasty JVM errors if you are used to Ruby's trivial (to the developer at least) h…

They're both amazing languages that are simultaneously very fun to use and very powerful, not to mention great with concurrency, but here's the grossly oversimplified gist of when you'd want which language:

Clojure has a beautiful dynamic type system. Haskell has a beautiful static type system. If you're working on a project with changing requirements (which for me means most nontrivial applications), Clojure will be much easier to work with and, as with most Lisps, is very well suited to what pg calls exploratory development. If you're working on a project whose requirements are largely static and known in advance (compilers, interpreters, parsers, static analyzers, mathematical tools, etc.), then you won't have to worry about coding yourself into a corner and Haskell's insanely powerful type system becomes a positive.

Re: Why I am excited about Clojure

#63

Earlier quoted context omitted.

Not having to memorize an operator precedence table makes me more than willing to give up syntactic sugar. This is one of the things that I dislike most about haskell. I wish liskell or one of the other projects trying to bring S-expressions to haskell had taken off.

>Not having to memorize an operator precedence table makes me more than willing to give up syntactic sugar. Really? This is such a big problem that you have to choose a completely different language.

Knowing what the AST looks like without having to sit an think about it is huge. Maybe you're smarter than me and can instantly intuit it, but I think most people can't. I think that this is one of the reasons that macros are so widely adopted in LISPs but not in other languages that support them. Having an immediately evident AST makes it much easier to reason about, and hence to manipulate either through code or manually.

Edit: Improve clarity.

Re: Why I am excited about Clojure

#64

I am a Ruby guy torn between diving into Haskell or Clojure. Help! Every time I get excited about one feature of one (ClojureScript) I learn the other has something equivalent or potentially better (Haste). One thing that has put me off on Clojure is 1) the ugly as hell JVM stacktraces, 2) hitting the wall of the number system results in nasty JVM errors if you are used to Ruby's trivial (to the developer at least) h…

So the two languages have all their strength and weaknesses. I start with Haskell, and I try Clojure, time to time. After working a while, I finally give a clear advantage to Haskell. Yes, Math people are chatty in Haskell, but you can do _a lot_ with very few Math. In fact, with Haskell, the more your project growth, the more time you spend on interesting things. While in Clojure (and most dynamic languages), you'll…

I'm curious how Haskell could be a clear winner for production code, particularly as it pertains to efficiency and time.

Clojure sits on top of the JVM, and as such, has the benefit of interop with some of the most robust software packages in the world.

Unless I'm missing something, you'd need to roll your own packages in Haskell for all this functionality.

I would argue that the most efficient code is well maintained open-sourced code that you don't have to write.

I don't use Haskell, so there may be lots of libraries I don't know about, so forgive me if this question is naive.

Re: Why I am excited about Clojure

#65
post #40

I am a Ruby guy torn between diving into Haskell or Clojure. Help! Every time I get excited about one feature of one (ClojureScript) I learn the other has something equivalent or potentially better (Haste). One thing that has put me off on Clojure is 1) the ugly as hell JVM stacktraces, 2) hitting the wall of the number system results in nasty JVM errors if you are used to Ruby's trivial (to the developer at least) h…

I'll try to dispel some of the concerns about Clojure. 1) Stacktraces in JVM may be ugly, but the amount of insight into runtime issues that the JVM offers you is generally way higher than in runtimes like cpython or MRI. 2) Clojure gives you a rather elegant way to work with the different JVM number types as it offers literals for those. I think Java Longs (the integer default) should be long enough as it's a 64 bit…

One thing I've noticed is that the JVM startup time is actually pretty small. What's slow is waiting for Clojure to bootstrap itself.

Re: Why I am excited about Clojure

#66
post #2

What is it about Clojure that Rubyists love? I am a Rubyist who is new to Clojure (I love it) and I cant explain it myself. Clojure was suggested to me by several other Rubyists. I find myself suggesting it to other Rubyists as well....

I remember reading one of PG's essays about Lisp being the most powerful language, and he made a list of characteristics defending his position. He implied that the new languages that are becoming popular simply move closer to being a Lisp. My guess is that Clojure is the Lisp that emerges most directly from someone who learned about languages from Ruby. I've only ever hacked with Ruby, if I can find a good intro series for non-coders to Clojure, I'm going to dive into it.

Re: Why I am excited about Clojure

#67

Man. I know Lispers hate hearing about it, but I was so on board with this until the sample ClojureScript code and all the parens. I just… don't wanna write code like that.

I felt the same way as you until I actually tried Clojure. In a few hours all my rejection of the parens dissapeared because I finally understood.

Try solving a small problem in Clojure (a code Kata, or a problem from Project Euler) and you'll see those aprehensions against the parens will go away.

Nowadays I'm having trouble to accept the syntax of other languages, eg. Scala :-)

Re: Why I am excited about Clojure

#68
post #50
post #36

The reason I end up with Python, CoffeeScript or Ruby and not a Lisp is the prefix notation and the parentheses. The parentheses can decrease readability and the prefix math expressions can make the order in which you think up a solution awkward. http://sourceforge.net/p/readable/wiki/Problem/ http://cs.brown.edu/~sk/Publications/Papers/Published/mfk-va...

The benefits of lisp 'syntax' are legion, to the point that I've come to feel that your position is unprofessional. Why wouldn't you try to get passed something as superficial as syntax, in order to better _make_ stuff? 1) Easier to learn and remember syntax for polyglots. No more Googling, shit like "what was the syntax for try-with-resources or the new multi-catch feature in java"? 2) The language tooling is so muc…

Julia [1] has 3 and 5, and almost 1 (it has very few built-in syntax sugars and a uniform way of invoking macros). It's targeted at scientists, so 4 is not an option, as infix syntax is a hard requirement for mathematics.

[1] http://julialang.org/

Edit: Elixir [2] is homoiconic as well, with even more uniform syntax (though it doesn't have special matrix syntax).

[2] http://elixir-lang.org/

Re: Why I am excited about Clojure

#69
post #34

Earlier quoted context omitted.

That's the neat thing about Lisp-style macros. You have to sacrifice a little bit of the syntactical sugar that you are used to in most languages, but in return you have the ability to add almost any possible construct to the language natively. It makes it much easier to extend the language as you don't need to hack an interpreter written in C or Java. Half of the core language is already written in macros.

Not having to memorize an operator precedence table makes me more than willing to give up syntactic sugar. This is one of the things that I dislike most about haskell. I wish liskell or one of the other projects trying to bring S-expressions to haskell had taken off.

There's nothing stopping you from using more parens in your own Haskell code; I definitely use them.

Re: Why I am excited about Clojure

#70
post #62

I am a Ruby guy torn between diving into Haskell or Clojure. Help! Every time I get excited about one feature of one (ClojureScript) I learn the other has something equivalent or potentially better (Haste). One thing that has put me off on Clojure is 1) the ugly as hell JVM stacktraces, 2) hitting the wall of the number system results in nasty JVM errors if you are used to Ruby's trivial (to the developer at least) h…

They're both amazing languages that are simultaneously very fun to use and very powerful, not to mention great with concurrency, but here's the grossly oversimplified gist of when you'd want which language: Clojure has a beautiful dynamic type system. Haskell has a beautiful static type system. If you're working on a project with changing requirements (which for me means most nontrivial applications), Clojure will be…

Wow. I came to the exact opposite conclusion you have. Changing requirements is really where Haskell shines. The ability to make a change in the types and have the compiler tell you everything that needs to be updated is an enormous aid to refactoring. As for exploratory programming? Haskell has powerful tools to do that as well. GHCI, type inference and typed holes[0] work extremely well for exploration of what's possible and can even give you solutions to your problem that you hadn't even thought of.

[0]. http://www.haskell.org/haskellwiki/GHC/TypedHoles

Post reply on HN