Live data from Hacker News

Getting Started With Clojure

jrheard.tumblr.com

11–20 of 113 posts

Re: Getting Started With Clojure

#11

The same thing could be done in Python (with requests) and Ruby (with whatever-it-is) with more clarity, less confusion, and much less consumption of resources.) (:headers resp) This construction is confusing - it breaks environmental model (scoping) and general evaluation rule of Lisps - is :headers a global symbol? a part of foo namespace? Is it macros? (resp :headers) On the other hand, this form is perfectly cons…

>This construction is confusing - it breaks environmental model (scoping) and general evaluation rule - is :headers a global symbol? a part of foo namespace? Is it macros? It follows Clojure's evaluation rules just fine: it's an object that implements the IFn interface. > On the other hand, this form is perfectly consistent - I'm sending to some closure which is bound in a global or other environment a constant messa…

How could you tell this from the code?)

Re: Getting Started With Clojure

#12

Earlier quoted context omitted.

>This construction is confusing - it breaks environmental model (scoping) and general evaluation rule - is :headers a global symbol? a part of foo namespace? Is it macros? It follows Clojure's evaluation rules just fine: it's an object that implements the IFn interface. > On the other hand, this form is perfectly consistent - I'm sending to some closure which is bound in a global or other environment a constant messa…

How could you tell this from the code?)

You can tell by knowing Clojure. Things that start with : are keywords, and keywords implement IFn.

Re: Getting Started With Clojure

#13

The same thing could be done in Python (with requests) and Ruby (with whatever-it-is) with more clarity, less confusion, and much less consumption of resources.) (:headers resp) This construction is confusing - it breaks environmental model (scoping) and general evaluation rule of Lisps - is :headers a global symbol? a part of foo namespace? Is it macros? (resp :headers) On the other hand, this form is perfectly cons…

[deleted]

Re: Getting Started With Clojure

#14

The same thing could be done in Python (with requests) and Ruby (with whatever-it-is) with more clarity, less confusion, and much less consumption of resources.) (:headers resp) This construction is confusing - it breaks environmental model (scoping) and general evaluation rule of Lisps - is :headers a global symbol? a part of foo namespace? Is it macros? (resp :headers) On the other hand, this form is perfectly cons…

[deleted]

Re: Getting Started With Clojure

#15

Earlier quoted context omitted.

>This construction is confusing - it breaks environmental model (scoping) and general evaluation rule - is :headers a global symbol? a part of foo namespace? Is it macros? It follows Clojure's evaluation rules just fine: it's an object that implements the IFn interface. > On the other hand, this form is perfectly consistent - I'm sending to some closure which is bound in a global or other environment a constant messa…

How could you tell this from the code?)

Because keywords are functions which are implemented such that:

    (:keyword m)
calls in turn

    (get m :keyword)
That's just a basic feature of the language. No macros involved.

Re: Getting Started With Clojure

#16
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 -- Leiningen will bootstrap itself when it's run for the first time, and when it's done you'll be presented with a Clojure REPL. Now you're ready to start exploring and learning:

http://clojure.github.com/clojure/

http://clojuredocs.org/

http://clojure-doc.org/

Also, please join the friendly community in #clojure on irc.freenode.net[5]. You'll find folks in there nearly 24/7 who are willing to answer questions you may have as you learn your way around. The discussion group[6] is also a great resource.

[1] http://leiningen.org/#install

[2] https://rvm.io/

[3] https://github.com/creationix/nvm

[4] http://perlbrew.pl/

[5] http://webchat.freenode.net/?channels=clojure

[6] http://groups.google.com/group/clojure

Re: Getting Started With Clojure

#17
I didn't know about clojure-toolbox. That's pretty neat.

One thing though, regarding this page, is that you don't need to install clojure with brew. Leiningen takes care of all that... clojure is just a jar that's included in your project, aka a dependency, and Leiningen manages that. This lets you tie a specific version of clojure to that project, which is handy for some legacy projects that aren't maintained anymore.

Also, if you drop the brew references, then this becomes OS agnostic. Just go to the leiningen page on github[1] and it'll get you started: osx, windows, linux.

I develop with clojure on my mac and I've not brewed anything related to clojure.

[1] https://github.com/technomancy/leiningen

Re: Getting Started With Clojure

#18

Earlier quoted context omitted.

How could you tell this from the code?)

Because keywords are functions which are implemented such that: (:keyword m) calls in turn (get m :keyword) That's just a basic feature of the language. No macros involved.

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.)

Re: Getting Started With Clojure

#19

I didn't know about clojure-toolbox. That's pretty neat. One thing though, regarding this page, is that you don't need to install clojure with brew. Leiningen takes care of all that... clojure is just a jar that's included in your project, aka a dependency, and Leiningen manages that. This lets you tie a specific version of clojure to that project, which is handy for some legacy projects that aren't maintained anymor…

This is something that clojure got right before any other language I'm familiar with did.

You do not "install" clojure. You depend on clojure just like you might log4j or joda-time

Re: Getting Started With Clojure

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

Post reply on HN