That seems pretty strange, and some of those examples are really hard to read. Care to share some real Lisp code and not just (a (b (c ... ))) examples? And maybe some motivating examples in Haskell? I just can't see how any of these are an improvement and I'm curious.
foo x y = x >>= \a -> case a of
Leaf -> ..
Branch aleft aright -> ..
which translates into the Scheme pseudocode
(define (foo x y) (bind x (lambda (a) (case a
((leaf) ..)
(branch aleft aright) ..)
Although such an indentation pattern (namely, multiple "unclosed" open parens on one line, which all get closed at once) is very uncommon in Scheme or Lisp code, I find it handy enough to trade off for certain other "competing" indentation patterns (namely, the one in the final example in grandparent) traditional in Scheme and Lisp.
I have been meaning to put my .emacs.d (5800 lines) on Github. Do you want me to email you when I have done so?
We must have different goals for our choice of indentation style: my goal is to minimize lines of code while preserving readability.
(Not lining things up as in
(f xxx
yyy)
initially detracts from readability, but in my experience with the new style, readability goes back up to very close to where it was as I get used to the new style.)
That makes much more sense given the snippet of Haskell and isn't so hard to read. No need to email though, I'm pretty happy with the standard Lisp indentation style. Thanks for clarifying.
By the way, any Emacker who shares my skepticism of the value of the traditional Emacs practice of having special indentation amounts for certain special forms and who prefers a slightly more regular/boring indentation style can get the TAB key to reflect that skepticism/preference with (setq lisp-indent-offset 2) and (setq lisp-body-indent 2) (or (setq lisp-indent-offset 4) and (setq lisp-body-indent 4) or such).
Disclaimer: untested on Emacs 23 or 24. (I'm still on Emacs 22.)
Comments
That seems pretty strange, and some of those examples are really hard to read. Care to share some real Lisp code and not just (a (b (c ... ))) examples? And maybe some motivating examples in Haskell? I just can't see how any of these are an improvement and I'm curious.
In Haskell it is not uncommon to see things like
which translates into the Scheme pseudocode Although such an indentation pattern (namely, multiple "unclosed" open parens on one line, which all get closed at once) is very uncommon in Scheme or Lisp code, I find it handy enough to trade off for certain other "competing" indentation patterns (namely, the one in the final example in grandparent) traditional in Scheme and Lisp.I have been meaning to put my .emacs.d (5800 lines) on Github. Do you want me to email you when I have done so?
We must have different goals for our choice of indentation style: my goal is to minimize lines of code while preserving readability.
(Not lining things up as in
initially detracts from readability, but in my experience with the new style, readability goes back up to very close to where it was as I get used to the new style.)I actually like the first one best, and would prefer a case-lambda even more. Once it becomes available we can write
modulo whatever syntax gets chosen. That would save an unnecessary temporary variable. (See https://groups.google.com/group/haskell-cafe/browse_thread/t...)Temporary variables clutter up the name space. While reading code you have to look for shadowing, or whether that variable is ever used again.
Agree about case lambda (and consequently that I could have chosen a better example).
That makes much more sense given the snippet of Haskell and isn't so hard to read. No need to email though, I'm pretty happy with the standard Lisp indentation style. Thanks for clarifying.
You are welcome.
By the way, any Emacker who shares my skepticism of the value of the traditional Emacs practice of having special indentation amounts for certain special forms and who prefers a slightly more regular/boring indentation style can get the TAB key to reflect that skepticism/preference with (setq lisp-indent-offset 2) and (setq lisp-body-indent 2) (or (setq lisp-indent-offset 4) and (setq lisp-body-indent 4) or such).
Disclaimer: untested on Emacs 23 or 24. (I'm still on Emacs 22.)