Live data from Hacker News

Getting Started With Clojure

jrheard.tumblr.com

21–30 of 113 posts

Re: Getting Started With Clojure

#21

Earlier quoted context omitted.

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

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.

Re: Getting Started With Clojure

#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 nice blog post that I could've read in 5 to 10 minutes as opposed to watching a 30 minute video.

Re: Getting Started With Clojure

#23
post #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

You still need to install the JVM. Python/perl/ruby require installers because you need some platform-specific stuff for each. Running everything inside the JVM means you only need to ship what any arbitrary JVM library requires. In this case, its as simple as a .jar.

Re: Getting Started With Clojure

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

I really suggest biting the bullet on "are we there yet" - it changed the way I think about state and identity (in that it got me to start thinking about them at all). I haven't found anything by him in written form aside from interviews, though, but I'm still really new here.

Re: Getting Started With Clojure

#25

Earlier quoted context omitted.

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

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 lisp datatypes aren't tied to specific concrete implementations and other datatypes (including user-defined ones) can participate in the same abstractions.

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.

Re: Getting Started With Clojure

#27

I wish people would at least attempt contributing to official documentation instead of spreading stuff across random blogs.

Fair point, mea culpa :) I'll carve out some time this weekend, figure out how to make this advice generic across platforms, and figure out how to contribute it to dev.clojure.org.

Re: Getting Started With Clojure

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

Re: Getting Started With Clojure

#29

Earlier quoted context omitted.

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

https://github.com/clojure/clojure/blob/master/src/jvm/cloju...

Re: Getting Started With Clojure

#30
post #27

I wish people would at least attempt contributing to official documentation instead of spreading stuff across random blogs.

Fair point, mea culpa :) I'll carve out some time this weekend, figure out how to make this advice generic across platforms, and figure out how to contribute it to dev.clojure.org.

Please do. Good writers like yourself can make a big difference right now. There's also the Clojure Doc project - http://clojure-doc.org/
Post reply on HN