[plt-scheme] Scheme contradictions

From: Paulo J. Matos (pocmatos at gmail.com)
Date: Tue May 9 19:01:33 EDT 2006

On 04/05/06, hendrik at topoi.pooq.com <hendrik at topoi.pooq.com> wrote:
> On Thu, May 04, 2006 at 02:27:57PM +0100, Vladimir Zlatanov wrote:
> > The funniest bit of all is that scheme and/or lisp have one of the
> > cleanest syntax conventions of them all. And probably that is the
> > biggest downside. In most of the mentioned languages like Python, Ruby,
> > Perl, C, php, plug your own, the weirdness in syntax is helping the
> > immediate visual recognition of what is going on. In scheme the visual
> > overview of a piece of code gets you only to a certain point, then you
> > need to start counting parenthesis, or at least the instinct tells you
> > so.
> >
> > I'm a scheme novice, but I have some experience in programming, so
> > these are my own impressions. I do like the clean syntax, but it really
> > gets to me, when I need do go down dirty and count, simply because I
> > made a typo. The [] addition helps with visual qeues. But is it enough?
> >
> > Maybe it can be a good thing to add python/ruby/haskell like layout
> > syntax. I know there were experiments flying around. Recently Peter
> > Schombert wrote an anlysis in his blog about it:
> >    http://pschombe.wordpress.com/2006/04/16/lisp-without-parentheses
> > I think it is a good idea, at least for people with experience in other
> > languages, to come to the lisp family. It is kind of syntactic sugar,
> > which can increase the readability of a program.
> >
> > I wouldn't mind having a go at this, the algorithm is nothing special,
> > just keep track of the context in a stack, there are one or two gotchas
> > more that in Peter's blog post, but still it shouldn't be hard. I just
> > wouldn't like doing a work already done - as far as I understand the
> > mzscheme reader already does indent tracking. It is used for error
> > reports and in the DrScheme indentation code.
> >
> > How complicated, and more importantly, where should I begin looking, if
> > I want to introduce something similar to #cs , let's say #ls for layout
> > sensitive? Can I do this by modifying the read tables, or I need to go
> > the full monty and implement a new lexer (I hope not)?
> >
> > Vlado
> Here's what I did decades ago in a Lisp dialect:
>   When the last element of a list is itself a list, I placed a slash in
> front of it and deleted the parenteses around the inner list.
> This was enough to eliminate almost all bracket counting.
> (a b c / d e f / g h i)
> instead of
> (a b c ( d e f ( g h i)))
> and it allowed a few syntacitc differences.
> For example I used
>    (let a b)
> instead of
>    (let ((a b)))
> (I forget just how many parentheses Scheme uses here)
> .
> So in a series of let's I could write
>   ( let a b
>   / let c d
>   / let e f
>   / onion a c e
>   )
> or an if-chain
>   ( if a b
>   / if c d
>   / let e (foo)
>   / if e joo
>   / alt a c
>   )

After seeing this code I just have to say: Is it just me or Scheme is
much more readable than this? I'm sorry but at least for me this
example is just not that trivial to read, I can't imagine if try to
use it with much more complex syntax.

Scheme syntax is a matter of practice. That's what I teach and what I
feel. Nowadays I can look at Scheme code and my brain automagically
recognizes what's important and what's not, I can 'see' where things
start and end. Probably after using your syntax I could do the same
thing. We get used to so many wierd things on daily life... I'm sure
scheme syntax is probably the less wierd stuff and surely not a reason
to get a new syntax, I think.

Just my 2 cents.

Paulo Matos

> Very convenient notation.
> -- hendrik
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme

Paulo Jorge Matos - pocm at sat inesc-id pt
Web: http://sat.inesc-id.pt/~pocm
Computer and Software Engineering

Posted on the users mailing list.