;; run-compiled-code.transcript ;; ============================= ;; load compiler and the compatible eceval-compiler (load "ch5-compiler.ss") (load "load-eceval-compiler.ss") ;; ============================= ;; run compiled code on eceval-compiler ;; you must exit the machine after each test ;; this is awkward; to relieve the burden, ;; do exercise 5.48 (compile-and-run) ;; test 1: factorial (compile-and-go '(define (factorial n) (if (= n 1) 1 (* (factorial (- n 1)) n)))) (factorial 5) ;; test 2: append (compile-and-go '(define (append x y) (if (null? x) y (cons (car x) (append (cdr x) y))))) (append '(a b c) '(d e f)) ;; test 3: fib (compile-and-go '(define (fib n) (if (< n 2) n (+ (fib (- n 1)) (fib (- n 2)))))) (fib 7)