Are all those parentheses in scheme (and lisp) readable? That's
probably the first question anyone asks when they see something like:
(map (lambda (x) (sqrt x)) '(1 2 3))
Below is an excellent response that summarizes an explanation I've seen
a few times.
The bottom line is that the parentheses don't get in the way any more
than those pesky space characters do between words. Spaces are only
invisible because your brain parses them out.
Now, should you try to write code without using an editor that does
smart indentation and paren handling? No, of course not. But try
writing Java code or any other language with the wrong environment and
you'll get the same results. Massive frustration.
In general, the question of readability is a loaded one. Readable to
who? To someone who knows the language? Or to someone who knows a
class of languages? Or to someone who knows nothing about the
language? Is readability the same thing as "uses a lot english words?"
Of course not, otherwise we would all be programming in cobol.
Think about it - is Hebrew a readable language? Well, if you don't know
Hebrew, then it's not. If you grew reading and writing it then it is.
In general, I think the question of readability is a discussion worth
avoiding. Instead, I'd rather talk about the kinds of abstractions I
can build up - which allow you to represent a concept in a clean way.
With the right abstractions, I think almost any language becomes
Oh, and you need patterns. Because, as the message below describes,
it's the patterns that our brain's thrive on.
From: Richard Cleis <email@example.com>
Subject: Re: [plt-scheme] question about dr. scheme indentation
Date: Mon, 10 Apr 2006 18:47:06 -0600
[original question about the best way to format Scheme trimmed]
Either of those formats reduces the compactness of Scheme. The 'usual'
format is very easy to read; after getting used to Scheme, the parens
disappear and your eyes see the relationship between the lines.
(define (myfunction myparam)
(let* ((myvar 10))
(+ myvar myparam)))
Not convinced? As you read sentences, you don't literally put
individual letters together to make words. Nor do you literally put
words together to make sentences. This may be hard to believe until you
experience one of those perception demos where you can read entire
paragraphs even though most of the letters are removed.
Your brain recognizes patterns then forms thoughts. Likewise, by
letting DrScheme form consistent patterns, you can read programs without