On Oct 1, 2006, Pablo Barenbaum (foones, at gmail dot, com) sent me
an email describing the following approach for a readable s-expression format,
and I thought others should be able to see it too.
========================================
Hi,
I've been reading your thoughts on s-expressions.
The rules for indentation of sweet expressions seem
too complex.
I once made a reader with the following extension
(inspired in Haskell):
(1) A colon is equivalent to an opening paren.
(2) The paren remains opened while the lines start
in a column greater than the one the colon was in
(or until EOF is found). In the toplevel, a blank line
also closes the paren.
For example:
:if c
t
e
=> (if c t e)
:let ::x1 v1
:x2 v2
:f x1 x2
=> (let ((x1 v1) (x2 v2)) (f x1 x2))
:defun fact (n)
:if (= n 0)
1
:fact n (* n (- n 1))
:+
:f x y
:f y x
=>
(defun fact (n)
(if (= n 0)
1
(fact (* n (- n 1)))))
(+ (f x y) (f y x))
--
It is orthogonal to s-expression syntax, thus
it doesn't introduce ambiguities...
--
Pablo Barenbaum
http://cubonegro.orgfree.com