Hi.

I'm not aware of any comprehensive style guide for Clojure. However,
there is a scheme style guide at
http://mumble.net/~campbell/scheme/style.txt
which contains plenty of good advice that applies to Clojure as well.

In addition to the above advice, I have a personal recommendation
regarding Clojure java interop: Avoid using the . (dot) form directly
-- use the sugared alternatives: (.field foo) for instance fields/
methods and Classname/staticField for static fields, eg. (println Math/
PI) or (System/exit 0).

My reasoning for this is that in a call form, the operator position is
more important than the rest of the list, and just having "." there
tells you nothing but that the code is going to access Java in some
way. If you use the specialised syntax, any reader of the code will
also immediately know whether you're accessing static or instance
fields.

Moreover, learn the -> macro. It can really make a big difference when
chaining lots of method calls. :) (There's also .., but I prefer ->
because it allows chaining both clojure functions and java methods)

--
Jarkko
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to