🌱Ian's Digital Garden

💾
Midnight Lisp


About

This is meant to be similar in spirit to the super-minimal lisp in 📜Recursive Functions of Symbolic Expressions and Their Computation by Machine.

Goals

  1. Be minimal
  2. Be nice to program in (e.g. let instead of label)
  3. Have at least a chance of acceptable performance

Perfomance-motivated changes

(When compared to the original Lisp paper)

  • Integer primitive
  • eval builtin function

Midnight also guarantees tail recursion elimination, though this isn't really a "change".

Other changes

  • Lexical instead of dynamic scope.
  • Evaluating a function results in a closure. In the original Lisp paper functions can't be evaluated and must be quoted to be passed as arguments to other functions.

Primitives

Lamba Calculus

lambda, let (recursive)

Lispy

quote, eval

Conditional

if

Pairs

car, cdr, cons, pair?, list-empty?

Symbols

symbol? symbol-eq?, codepoints->symbol, symbol->codepoints

Ints

int?, +, -, *, /, %, <, =, >

Debug

crash, trace, trace-time

Backlinks