Previous: , Up: Introduction   [Contents][Index]

1.7 LISP as Maxwell’s Equations of Software

As fate would have it, I stumbled upon this interview with Alan Kay, where he shares a revelation he had when reading John McCarthy’s LISP-1.5 manual:

that was the big revelation to me … when I finally understood that the half page of code on the bottom of page 13 of the Lisp 1.5 manual was Lisp in itself. These were “Maxwell’s Equations of Software!” This is the whole world of programming in a few lines that I can put my hand over.

Alan Kay

Our starting point is hex0, a 500 byte hex assembler and we need to somehow close the gap to building the bootstrap binary seed, esp. GNU Gcc and the GNU C Library. What better way to do that than by leveraging the powers of LISP?

GNU Mes is a Scheme12 interpreter that will be indirectly bootstrapped from hex0 and that wields the magical powers of LISP to close the bootstrap gap, asserting we can enjoy software Freedom 1.

1.7.1 Auditable Elegance

eval and apply are mutual recursing functions that—using a few helper functions—describe the core of the universe of computing.

(define (apply fn x a)
   ((atom fn)
     ((eq fn CAR)  (caar x))
     ((eq fn CDR)  (cdar x))
     ((eq fn CONS) (cons (car x) (cadr x)))
     ((eq fn ATOM) (atom (car x)))
     ((eq fn EQ)   (eq (car x) (cadr x)))
     (#t           (apply (eval fn a) x a))))
   ((eq (car fn) LAMBDA)
                   (eval (caddr fn) (pairlis (cadr fn) x a)))
   ((eq (car fn) LABEL)
                   (apply (caddr fn) x
                          (cons (cons (cadr fn) (caddr fn)) a)))))
(define (eval e a)
   ((atom e) (cdr (assoc e a)))
   ((atom (car e))
    (cond ((eq (car e) QUOTE) (cadr e))
          ((eq (car e) COND)  (evcon (cdr e) a))
          (#t                 (apply (car e) (evlis (cdr e) a) a))))
   (#t       (apply (car e) (evlis (cdr e) a) a))))

It will be a big day when our computers are fully bootstrapped from source. It would be nice if that source code were readable, auditable and elegant. To be honest, the elegance displayed above that we achieved at the very start of the Mes project is currently hard to find. It is our sincerest hope to bring back this level of quality and elegance..



Scheme is a modern LISP

Previous: Full Source Bootstrap, Up: Introduction   [Contents][Index]