在 Racket 上使 SICP 达到 运行:练习 4.48,无法使 load() 工作
getting SICP to run on Racket: excercise 4.48, cannot get load() to work
我正在尝试解决 SICP 中的练习 4.48。我正在尝试将加载机制设置为 运行,即加载 ch4-mceval.scm(期望所有定义都可用)但我似乎没有得到正确的语法。
我试过了
#lang planet neil/sicp
和 #lang sicp
,尝试了 (load "ch4-mceval.scm")
和 (#%require "ch4-mceval.scm")
,都没有成功。
我有一个笨拙的解决方法,我基本上将两个文件合并为一个文件,但我发现那真的很难看。
如有任何帮助,我们将不胜感激。
开始 ch4-ambeval.rkt,尝试加载 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")
我在DrRacket中试过mceval.scm,load
似乎没什么问题。
P.s我没有planet neil/sicp
,因为Racket(>8.0)已经有built-insicp语言
我正在尝试解决 SICP 中的练习 4.48。我正在尝试将加载机制设置为 运行,即加载 ch4-mceval.scm(期望所有定义都可用)但我似乎没有得到正确的语法。
我试过了
#lang planet neil/sicp
和 #lang sicp
,尝试了 (load "ch4-mceval.scm")
和 (#%require "ch4-mceval.scm")
,都没有成功。
我有一个笨拙的解决方法,我基本上将两个文件合并为一个文件,但我发现那真的很难看。
如有任何帮助,我们将不胜感激。
开始 ch4-ambeval.rkt,尝试加载 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")
我在DrRacket中试过mceval.scm,load
似乎没什么问题。
P.s我没有planet neil/sicp
,因为Racket(>8.0)已经有built-insicp语言