Search code examples
racketsicp

getting SICP to run on Racket: excercise 4.48, cannot get load() to work


I'm trying to solve excercise 4.48 from SICP. I'm trying to get the loading mechanism to run, i.e. load ch4-mceval.scm (with the expectation that all the definitions are available) but I don't seem to get the syntax right.

I've tried

#lang planet neil/sicp and #lang sicp, tried (load "ch4-mceval.scm") and (#%require "ch4-mceval.scm"), all unsuccesffuly.

I have a kludgy workaround where I basically merged the two files into one, but I find that really ugly.

Any help would be greatly appreciated.

start of ch4-ambeval.rkt, which tries to load ch4-mceval.rkt

#lang planet neil/sicp ; added 07 MAR 2022
;;;;AMB EVALUATOR FROM SECTION 4.3 OF
;;;; STRUCTURE AND INTERPRETATION OF COMPUTER PROGRAMS

;;;;Matches code in ch4.scm.
;;;; To run the sample programs and exercises, code below also includes
;;;; -- enlarged primitive-procedures list
;;;; -- support for Let (as noted in footnote 56, p.428)

;;;;This file can be loaded into Scheme as a whole.
;;;;**NOTE**This file loads the metacircular evaluator of
;;;;  sections 4.1.1-4.1.4, since it uses the expression representation,
;;;;  environment representation, etc.
;;;;  You may need to change the (load ...) expression to work in your
;;;;  version of Scheme.
;;;;**WARNING: Don't load mceval twice (or you'll lose the primitives
;;;;  interface, due to renamings of apply).

;;;;Then you can initialize and start the evaluator by evaluating
;;;; the two lines at the end of the file ch4-mceval.scm
;;;; (setting up the global environment and starting the driver loop).
;;;;In the driver loop, do
;(define (require p)
;  (if (not p) (amb)))


;;**implementation-dependent loading of evaluator file
;;Note: It is loaded first so that the section 4.2 definition
;; of eval overrides the definition from 4.1.1
(load "ch4-mceval.scm")

Solution

  • I tried mceval.scm in DrRacket, it seems nothing wrong with load.

    P.s I did not planet neil/sicp, because Racket (>8.0) has already a built-in sicp language.

    enter image description here