[comp.lang.c] Tradition Lisp code formatting

sboswell@sdcc13.ucsd.edu (....What Is?....) (06/23/91)

I wanted to post this a long time ago but feared starting a flame war.
But my curiosity has finally gotten the better of me.  I must know. :)

How did the traditional style of Lisp code turn out to be so crunched
together?

In languages like C, the trend has been to space everything out so
that blocks are visible (see GNU Emacs "c-mode" to see what I mean,
if you don't.)  I find it much more readable like that.  But in my
Lisp books, it seems, comparatively, smashed together!  Here's an
example, from page 115 of _Lisp: 3rd Edition_ by Patrick Henry
Winston and Berthold Klaus Paul Horn:

(defun count-outlyers (list-of-elements)
  (let ((result 0))
    (dolist (element list-of-elements
		     result)
    (when (or (> elements boiling)
	      (< element freezing))
      (setf result (+ result 1))))))

I would have formatted it this way:

(defun count-outlyers (list-of-elements)
    (let
	(
	    (result 0)
	)
	(dolist
	    (element list-of-elements result)
	    (when
		(or
		    (> element boiling)
		    (< element freezing)
		)
	        (setf result (+ result 1))
	    )
	)
    )
)

Whether to split and indent the (element list-of-elements result) is
usually a matter of whether or not the one-line version makes the
functionality immediately obvious, to me.  But to me, the functionality
of let seems much more obvious; the local variable "result" has been
created, and it's used inside a dolist.  (Incidentally, the only
reason I put the defun's argument list in the same line is so I can
do "grep '(defun' file.lisp" from csh to get a list of all the function
prototypes in the source file.)

So far, I've only found one other person who formats the way I do,
and he hates Lisp nowadays :-( so although it's not a very scientific
conclusion, I'd say there's at least a chance of programmers being
turned off by Lisp because they feel lost in all the parentheses and
cannot immediately divine the structure.  (He would get his Lisp
assignments back from the TA, re-formatted to the traditional way :)

I crossposted to a few seemingly unrelated newsgroups in the hopes
of finding people who were disenchanted with Lisp, to ask if this
was part of the reason.

Please give me your thoughts on this.  No Holy War(TM) intended. :-|

Steve Boswell         | This opinion is distributed in the hopes that it
whatis@ucsd.edu       | will be useful, but WITHOUT ANY WARRANTY...
whatis@gnu.ai.mit.edu |