LispSpace

From Esolang
Jump to navigation Jump to search

LispSpace is a Lisp syntax that uses whitespace for brackets. This should work with any Lisp that doesn't explicitly need reader macros. The whitespace size is exactly 2 spaces, no more, no less. Space count on empty lines does matter, as it can mean an s-expression ending.

Format

2 spaces correspond to an s-expression. For example,

  A
    B
    C
  D

is equivalent to

(A (B C) D)

To seperate 2 s-expressions of the same level, you can use tab (not spaces) to seperate them. For example,

  A
    B
    C	
    D
    E
  F

is (where \s is 2 spaces, \t is tab and \n is newline)

\sA\n\s\sB\n\s\sC\t\n\s\sD\n\s\sE\n\sF

which is equivalent to

(A (B C) (D E) F)

Examples

Hello world function (Common Lisp)

  defun
  hello
    	
    format
    t
    "Hello, World!"

Define a square function, and execute it with 5 (Common Lisp)

  defun
  square
    x	
    *
    x
    x

  square
  5