[plt-scheme] Paren Paralysis Sufferers Unite

From: hendrik at topoi.pooq.com (hendrik at topoi.pooq.com)
Date: Wed Oct 21 21:33:38 EDT 2009

On Wed, Oct 21, 2009 at 12:54:04PM -0400, hendrik at topoi.pooq.com wrote:
> On Wed, Oct 21, 2009 at 07:03:56AM -0400, Geoffrey S. Knauth wrote:
> > On Oct 16, 2009, at 15:29, Morgan wrote:
> > 
> > >It just seems a bit unreasonable, c++ and java are entirely happy to
> > >allow my superfluous parentheses I'm accustomed to using, it can make
> > >the code easier to read after all.
> 
> In C++ and java, parentheses make things readable because there are so 
> few of them.  It's usually easy to just see mathcing parentheses.
> 
> In all the Lisps, there are so many parentheses anyway, that 
> having redundant ones would just add to the visual confusion.
> 
> I think Lisp badly needs simpls syntactic schemes to reduce the number 
> of parntheses and make parentheses-matching visualy easier.  But every 
> proposal I've seen or made gets shouted down with complaints of "We've 
> learned to count parentheses -- Why can't you?"

OK.  Here's what I used in a Lisp dialect once:

     ( foofoofoo / barbarbar )

means

     ( foofoofoo ( barbarbar ))

where foofoofoo and barbarbar are each sequences of s-expressions.

Of course, you can iterate:

    ( foo / bar / clum / ink )

means

    ( foo ( bar ( clum ( ink ))))

And that's all there is to it.

It was inspired by notincing that huge clusters of close-parenthese 
arise.  This gets rid of most of them.

And you can write it vertically if you want:

    ( foo
    / bar
    / clum
    / ink
    )

if you like lining things up vertically.

This is useful for some kinds of nested if's:

    ( if a b
    / if c d
    / if e f
    / error 'nogood
    )

  It also leads to a desire for constructs that don't themselves contain 
lists as a syntactic hack to cut down on nesting. It makes if's easier 
to use than cond's, for example.

-- hendrik


Posted on the users mailing list.