Lisp syntax, but using whitespace to remove most parentheses.
- Every line is wrapped as a list. Use
do
to get just the value. - Empty lines are ignored.
- Indented lines are concatenated to their parent lists.
- A pipe (
|
) acts like indentation without wasting whitespace. - Use square brackets for inline lists.
- Use round parentheses for infix notation (first two items are swapped)
For example, take the following lisp style program:
(print "Hello World")
(for (x 10)
(for (y 10)
(printf "%d + %d = %d" x y (+ x y))
)
)
In my modified syntax, this would look like:
print "Hello World"
for [x 10] | for [y 10]
printf "%d + %d = %d" x y (x + y)
A recursive Fib function could look like:
let fib | λ [n]
if (n ≤ 2)
do 1
do ([fib (n - 1)] + [fib (n - 2)])
Implement it in Racket and see how it works out for real programs. it is easy to make a new reader at the #lang level and just use the rest of Racket syntax. Make sure you read about the history of paren-less LISP though, such as sweet.