name(s)typeargsexamples
nil  true  falseconstants
consfunction2cons 4 '(2)
car  cdrfunctions1car '(4 2)  cdr '(4 2)
cadr  caddrfunctions1cadr '(1 2 3 4)  caddr '(1 2 3 4)
appendfunction2append '(1 2 3) '(3 4 5)
lengthfunction1length '(2 2 2)
atomfunction1atom 42
+  -  *  ^functions2* 6 7  ^ 2 10
=function2= '(1 2) '(2 1)
<  >  <=  >=functions2< 1 2  >= 42 43
base10-to-2function1base10-to-2 42
base2-to-10function1base2-to-10 '(1 0 1 0 1 0)
ifmacro3if atom nil 42 43
'macro1'(1 2 3 4)
"macro1"(car (' (1 2)))
lambdafunction2('lambda (x) + 40 x 2)
letmacro3let (f x y) (* x y) (f 6 7)
let x 2 (+ 40 x)
evalfunction1eval '(* 3 14)
sizefunction1size '(cons 2 nil)
success  failureconstants
no-time-limit  out-of-time  out-of-dataconstants
display  debugfunction1display - 50 8
trymacro3try no-time-limit 'display read-bit '(1 0)
bitsfunction1bits '(cons 1 nil)
read-bit  read-expfunctions0try 100 'read-exp bits '+ 3 4
run-utm-onmacro1run-utm-on bits ' * 6 7
[Press ESC to dismiss.]

Chaitin's Lisp

This is a WebAssembly port of Gregory Chaitin's minimal Lisp interpreter from his book Exploring Randomness. More details below.

The interpreter should behave exactly like Chaitin's original Lisp as the WASM file was created from his C code; I just added the run-utm-on macro from the book. You can type Lisp code into the text area and use the Send button to send it to the interpreter. (Alternatively, you can press Shift-Return.) The output will be shown in the gray region below the textarea. You can also drag and drop text files with Lisp code (like these) onto the text area. Note that you'll have to use Chaitin's "M-expression" syntax which feels slightly weird for experienced Lisp hackers: car '(a b) is OK while (car '(a b)) won't work as expected. You can, however, use the double-quote escape mechanism and type the somewhat clumsy "(car (' (a b))). To see a "cheat sheet" press F1 or click here.

Input from the text area is "cleaned" before it is sent to Lisp - which means that all but a few strictly necessary ASCII characters (letters, digits, and about half a dozen other symbols like parentheses) are removed. It's OK to enter several expressions at once, but incomplete M-expressions like cons '(a b) will be ignored.

Everything happens in the same image (or "session"), i.e. the Lisp "remembers" the side effects of your previous inputs. If you want to restart the Lisp image, you have to reload the page.

Note that this is a very minimalistic Lisp which was created to prove mathematical theorems. It is not meant to be a general-purpose programming language like Common Lisp.

Copyright (c) 2020, Prof. Dr. Edmund Weitz. Impressum, Datenschutzerklärung.