On Dec 3, 3:06 pm, levand <[EMAIL PROTECTED]> wrote:
> I am coming to Clojure from the Java side, and am completely ignorant
> about lisp indentation & newline conventions.
> Some things are easy to pick up from posted examples and common
> sense...newline + tab after the parameters vector when defining a
> function, etc.
> But I did some web searches on lisp & emacs conventions, and some
> things aren't so clear. For example, this googled web page (http://
> dept-info.labri.u-bordeaux.fr/~strandh/Teaching/MTP/Common/Strandh-
> Tutorial/indentation.html) indicates that in the "if" special form,
> each sub-expression should be aligned. Is this accomplished by tabs +
> spaces until they align? What if the editor isn't using a fixed-width
> font (or is it assumed that it always is?) Or is that the emacs editor
> aligning things irrespective of what whitespace characters are really
> there?
> Which leads to the other immortal question - tab characters, or [n]
> consecutive spaces? I'm fairly ambivalent myself and can go either
> way, but is there a clear preferred way in the clojure community that
> I would be better served by adhering to?
> Does anyone know of a reference for, or would care to enumerate what
> standard clojure indenting ought to be?
> I'm particularly interested in this as I've been hacking about with a
> clojure eclipse plugin for my own use and am considering adding auto-
> indent features.

After twenty years as a working lisp programmer, the rule of thumb I
use for readable lisp indentation style is, imagine the parentheses
are invisible; now use indentation to convey the grouping of
expressions and subexpressions. In general, indent parallel expression
to the same level; indent subsidiary expressions to a deeper level.
Break those rules when it will make the code clearer and more

  let  foo bar
       baz grault

  let   foo bar
        baz some-function

Use spaces. Tabs are evil, because every editor does something
different with them, and indentation is meaningful.

You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 

Reply via email to