Live data from Hacker News

Getting Started With Clojure

jrheard.tumblr.com

41–50 of 113 posts

Re: Getting Started With Clojure

#42
post #28

This is a great article. More articles in similar tone are needed to highlight how simple this language is. A big disservice to Clojure was probably done by a few early adopters of Clojure who hyped up the LISP heritage of the language to the extent it turned away C/java guys like myself: I recall reading somewhere that in order to learn Clojure , one had to master SICP and Scheme. That was a huge learning curve I di…

Which is why I have been telling people it's a "better Python".

With dramatically different design goals from Python?

Even if I like Ruby better than Java, it doesn't make Ruby a better Java because they are doing quite different things.

Re: Getting Started With Clojure

#43
post #7

Very nice, JR, best guide I've seen. I've always wished, though, that all "getting started" guides would just provide a chef recipe or machine image with everything ready to go. Getting to know a language shouldn't require jumping through an hour of hoops and documentation to get it set up. (Of course, the guide here is broader than simply getting your system set up.)

Thanks to Leiningen[1], getting started with Clojure is super simple. It doesn't get much easier than pulling down the master `lein` script (or `lein.bat` for Windows) with wget/curl and setting it up on your PATH as an executable. This is similar to rvm[2], nvm[3], perlbrew[4], et al. You'll need to have Java installed before proceeding to the next step. Once you've done that, you can run `lein repl` in your shell -…

I wanted to get Clojure on my secondary machine to do a little light fiddling, but as it turns out, Windows doesn't include wget or curl, and lein.bat requires those. So I have to download something that requires me to download something so I can download something that will let me install the thing I wanted in the first place. I think it could be a bit easier.

Re: Getting Started With Clojure

#44
post #22

I knew about clojars.org, but I hadn't known about http://www.clojure-toolbox.com/ . Very nice! I also recommend the Value of Values video presentation: http://www.infoq.com/presentations/Value-Values . It will help you internalize Clojure's approach to data. I really wish I could remember why I didn't experience nearly as much pain starting out as the author, but I'm glad that he took the trouble to put this togethe…

Off topic perhaps, but is Rich Hickey's wisdom only summarized in talks, or has he written some of this down? I see a number of glowing reviews of videos like this. While I don't want to miss out, I would personally much rather consume this info in writing. The one I did bite the bullet on and watch in full was his talk on “hammock-driven development”. I liked it, but couldn't help feeling it would have made a very n…

While 'Joy of Clojure'[1] can in no way be considered "the way Rich thinks", we have tried very hard to capture the Clojure philosophy as we understand it. This is based on personal interactions with Rich, his talks, the Clojure and Clojure implementations, Datomic, IRC chats and experience using the language every day.

[1]: http://www.joyofclojure.com

Re: Getting Started With Clojure

#45
post #21

Earlier quoted context omitted.

No, there is no syntactic transformation. The keyword is a function i.e. (in Java terms) it implements the IFn interface. The effect of that function is the same as calling the get function on a map using the keyword as the argument.

In Lisp terms, however, a keyword is a self-evaluating symbol , a constant. If it is a function, where it is defined and when? That's why I'm arguing that this form is confusing, and that transformation is more correct notion, at least if people are insisting to call it Lisp.)

> If it is a function, where it is defined and when?

Call it "callable" if you prefer. Much the same way as in C++ objects that define operator() are callable; only cleaner.

Re: Getting Started With Clojure

#46
post #25

Earlier quoted context omitted.

So, reader knows about keywords and does this implicit syntactic transformation? It seems to me that a function must be defined somewhere before one could call it.)

The keyword syntax is transformed into a keyword instance by the reader, and keyword instances implement IFn as objects on the JVM, hence can be used as functions under clojure's evaluation rules. As I understand it, the roles which things like lists and functions play in a traditional lisp are replaced in Clojure by abstract datatypes corresponding to Java interfaces. Which on one hand is kinda neat because the core…

    On the other hand it means the semantics 
    become quite tied up in underlying JVM-related 
    details and don't seem as clean/elegant as (say) 
    Scheme.
That's not very true. Instead, Clojure is defined in terms of specific abstractions. Whether those take the form of interfaces or protocols is irrelevant because it's the abstractions that count. If it were tied strictly to JVM-related details then ClojureScript would have been much harder to implement than it was.

The elegance of Scheme is subjective.

Re: Getting Started With Clojure

#47
post #34

> The reason that you won’t find yourself running `clj` often is that the REPL built into bare Clojure is pretty much garbage.... This is what rlwrap is for. Call `rlwrap clj` instead of `clj`, and you get all that and more (C-r, for reverse incremental search, etc). Works with every other REPL that doesn't bother to re-implement read-line.

Using a raw repl at all is painful compared to just selectively evaluating expressions from a buffer (say, in Emacs, VimClojure, or the Eclipse and IntelliJ plugins).

I must second this. You can get used to it, and I did. For a while, I used Vim or ST2 + a terminal window with lein repl.

As of a week or so ago, I started using Emacs with Clojure & nrepl. Aside from the occasional teething problems (still not used to the Emacs paradigm), it's amazing. Merely having the REPL in a text-editor-like buffer is a big win, and there's a bunch more that I'm still incorporating into my workflow.

Re: Getting Started With Clojure

#48

This is a great article. More articles in similar tone are needed to highlight how simple this language is. A big disservice to Clojure was probably done by a few early adopters of Clojure who hyped up the LISP heritage of the language to the extent it turned away C/java guys like myself: I recall reading somewhere that in order to learn Clojure , one had to master SICP and Scheme. That was a huge learning curve I di…

I had the same experience. When I first heard about Clojure, one of the first things I learned was that it was a Lisp. But having read in numerous comments, blog posts etc. that "only the top percentile of programmers use Lisp", and since I don't consider myself to be anywhere near the top percentile, I felt that my programming chops might not be adequate enough to learn it.

So I put off learning Clojure for about a year or so. However, I grew more and more weary of Java's obvious shortcomings, the inherent bureaucratic nature of the language and lack of modern programming features (such was the situation at the time at least, things are starting to look better for Java nowadays) and started to look to other languages. I tried Scala. It didn't work out. I still wanted to leverage my existing knowledge of JVM and the whole Java ecosystem, so I turned to Clojure again. Also, having spent perhaps too much time on HN, I really wanted to see what that fuss about Lisp was all about.

Anyway, what I found out was that you do not, in fact, need to be a genius developer to learn Clojure. Actually, Clojure was everything I hoped for. It's dead simple. The syntax is minimal compared to some other languages. You may have heard other people say that learning Lisp can be an enlightening experience. Yes, there definitely are some enlightening moments, but not in the sense that you need to spend years meditating on something to be able to understand it. Read a good book, there are plenty of those around now, watch some of Hickey's talks, and you'll get it.

To summarize, here's my message to anybody who is thinking of learning Clojure - don't get discouraged and give up on Clojure before even trying to learn it just because it's a Lisp. It may seem strange and perhaps a little frightening at first, but once you spend some time with it, you'll get amazed at how wonderfully simple it really is, and how powerful it is precisely because of this simplicity.

Re: Getting Started With Clojure

#49
post #43

Earlier quoted context omitted.

Thanks to Leiningen[1], getting started with Clojure is super simple. It doesn't get much easier than pulling down the master `lein` script (or `lein.bat` for Windows) with wget/curl and setting it up on your PATH as an executable. This is similar to rvm[2], nvm[3], perlbrew[4], et al. You'll need to have Java installed before proceeding to the next step. Once you've done that, you can run `lein repl` in your shell -…

I wanted to get Clojure on my secondary machine to do a little light fiddling, but as it turns out, Windows doesn't include wget or curl, and lein.bat requires those. So I have to download something that requires me to download something so I can download something that will let me install the thing I wanted in the first place. I think it could be a bit easier.

It certainly could be better, but none of the maintainers know Windows, and no Windows users have contributed improvements.

Re: Getting Started With Clojure

#50
post #43

Earlier quoted context omitted.

I wanted to get Clojure on my secondary machine to do a little light fiddling, but as it turns out, Windows doesn't include wget or curl, and lein.bat requires those. So I have to download something that requires me to download something so I can download something that will let me install the thing I wanted in the first place. I think it could be a bit easier.

It certainly could be better, but none of the maintainers know Windows, and no Windows users have contributed improvements.

Which is fair. I don't use Windows a lot myself — this is basically the "League of Legends and Sims 3 machine." I was just pointing it out because lein.bat was mentioned, and I found it kind of surprising given how easy Leiningen is on other platforms.
Post reply on HN