Lisp as Python

Lisp but written like Python


Because "too many parentheses" is a valid complaint from the crowd. While experienced Lisp programmers are accustomed to parentheses, not everyone is. Establishing the mental circuitry for handling parentheses is unnecessary. Computers can do the job for us.

We love Lisp for its macro system , the ultimate freedom. By using Python's indentation style we may get more people on board. Code should not be noisy, so let's exploit the human visual system to create code we consider pleasing.

Transformation rules

These simple rules allow us to write Lisp as Python which should work for any Lisp:

  1. Each line is surrounded by parentheses.
  2. If a line ends in `:`, expect an indentation on the next line. Do not print a closing parenthesis yet.
  3. If we see a dedent, print out a `)`.

In addition, we also allow escaping parenthesization using `\`, as well as comments `;`:

  1. A line starting with `\` is not parenthesized. The string `\ ` is removed from the output.
  2. A trimmed line starting with `;` is not parenthesized.

You can download the script that transforms "lispy" into lisp here.