Live data from Hacker News

Why I am excited about Clojure

blog.txus.io

71–80 of 173 posts

Re: Why I am excited about Clojure

#71
> With Clojure your editor (be it Vim, Emacs, Light Table...) is permanently connected to a live REPL. You continually develop, test and modify functions with subsecond feedback. Continuously.

Can anyone explain or point me in a direction where I can learn how the above functionality is actually used and useful?

I keep hearing about live-editing/hot-reloading, and in theory I believe it must be very useful, but I cannot concretely imagine how it would be used in practice. What kind of programs can work like that? Continuously running programs, like web servers/GUI programs? So what happens when you change a function? Do you manually simulate a web-request? Rerun unit tests? Would it work with command-based pipelined programs, such as compilers as well?

Re: Why I am excited about Clojure

#72

> 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…

Thanks, I'll check them all out. I've been playing with languages for a few years now and built some really tiny, throwaway stuff. I'd say I grasp the basic concepts of programming pretty well (by basic I mean the very basic), but I still very much feel new to programming. I started with Ruby because it's accessible, but ever since I've learned about them, I've wanted to eventually learn a Lisp.

Re: Why I am excited about Clojure

#73
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…

Although 'coding yourself into a corner' is definitely possible, I would rather hope that one makes good decisions, there is plenty of space to type things and allow re-usability and flexability. You could make a similar but different negative statement about clojure, about having to maintain a large project when the requirements change, if you're not careful you may find a change in one part of the code breaks another part of the code.

Re: Why I am excited about Clojure

#74
post #58
post #26

Earlier quoted context omitted.

If you remove macros and s-expressions from a simple lisp.. what remains? Genuinely curious. If I'd had to guess I say just the spirit of the language, the macros being reincarnated as the highly dynamic smalltalk method system. The s-expressions being reincarnated as the blocks.

> If you remove macros and s-expressions from a simple lisp.. what remains? java script :)

Brendan Eich was hired to Netscape to "put Scheme in the browser", he ended up with Javascript.

see also: https://mxr.mozilla.org/mozilla/source/js2/semantics/

Re: Why I am excited about Clojure

#75

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.

Everything in life a tradeoff. You should watch this video: http://www.infoq.com/presentations/Simple-Made-Easy

The parens are annoying, until:

a) You build that fully composable library that you always wished you could have written in X language, but it neeeeever quite worked the way you wanted.

b) You realize that by keeping your data immutable, it allows you to write less tests, be more confident in your code, and you stop worrying "is that value is what I think it is?"

c) By building on top of the JVM, you are able to use java interop to save yourself a day of coding a custom library for something that exists and is well tested.

d) Deployment becomes a breeze because you just export a jar/war file and load it up into any of the existing app servers.

e) You get phenomenal speed increases for "free" if you're coming from dynamic languages like ruby/python/PHP

f) When you need to dip into async code, you can write your async code, in a synchronous fashion, which (for me) is much easier to think about then keeping track of callbacks in my head.

Good luck, if you decide to give it a shot, I think you might realize the parens isn't such a big deal in the long run!

Re: Why I am excited about Clojure

#76
post #70
post #62

Earlier quoted context omitted.

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 po…

I agree, though one has to compare apples and apples. experienced programmer vs inexperienced programmer is not fair. Of course if one is unfamiliar with how to build a flexible type safe systems, (newbies), there could be these sorts of issues. But for experienced programmers, not really.

Re: Why I am excited about Clojure

#77
post #71

> With Clojure your editor (be it Vim, Emacs, Light Table...) is permanently connected to a live REPL. You continually develop, test and modify functions with subsecond feedback. Continuously. Can anyone explain or point me in a direction where I can learn how the above functionality is actually used and useful? I keep hearing about live-editing/hot-reloading, and in theory I believe it must be very useful, but I can…

The beauty of Clojure (and all functional languages) is that everything your app does is made of very small functions composed together. You wouldn't really simulate the round trip http request via the REPL but you can change and test idempotent functions independent of each other. Most Clojure functions are under 15 lines of code.

You can also mess around with transforming state that you may have stored in an atom...

Re: Why I am excited about Clojure

#78

Earlier quoted context omitted.

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 maintaine…

Which kind of libraries are you thinking of that are missing?

Re: Why I am excited about Clojure

#79
post #53

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…

General advice: don't let the desire to learn the "right" thing prevent you from learning, period. Eventually, it's better to just make a choice and dive in, then to spend more time trying to figure out which one is "better".

Agreed 100%. I can learn both, given enough time.

Re: Why I am excited about Clojure

#80
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.

In that case you can either use $ or parenthesis in Haskell. I personally find the code neat without any parenthesis noise.
Post reply on HN