Steele and Sussman
48
The Art of the Interpreter
The code for PRINT-NUMBER
would then be written:
(DEFINE (PRINT-NUMBER N)
((LAMBDA (Q R)
(COND ((ZEROP Q) (PRINT-DIGIT R))
(T (PROGN (PRINT-NUMBER Q)
(PRINT-DIGIT R)))))
(/ N (DYNAMIC RADIX))
(REMAINDER N (DYNAMIC RADIX))))
Most of the extra complexity in Figure 15 is devoted to the parsing of LAMBDA
-expression binding lists upon application by APPLY-PROCEDURE
. (For the sake of brevity we have omitted the parts of the interpreter which deal with SETQ
and PROGN
; they could easily be re-inserted.)