I am reading SICP 4.1.3 Evaluator Data Structures
(define (make-frame variables values)
(cons variables values))
(define (frame-variables frame) (car frame))
(define (frame-values frame) (cdr frame))
(define (add-binding-to-frame! var val frame)
(set-car! frame (cons var (car frame)))
(set-cdr! frame (cons val (cdr frame))))
However, the set-car!
is reported as unbounded in racket.
Then tried implements of 'GNU Guile 2.2.6', "GNU mit-scheme 10.1.10", unfortunately, set-car!
are all not bound.
Search through the whole book of original version:
find . -type f -iname "*.org" -exec grep --color -nH --null -e "set-car!" \{\} + |wc -l
27
There are 27 occurrences through chapter 3 4 and 5,
and within chapter 3 I change setcar! to setcar of elisp. but elisp is not a good option for chapter 4 of metalinguistic abstraction.
The chapter 4 is bits of difficult thus now risk of adventure.
I find the good solution set-car!, set-cdr! unbound in racket?
(require rnrs/mutable-pairs-6)
As a solution, If replace set-car!
set-cdr!
with set-mcar!
set-mcdr
, the codes of chapter 4 and 5 will run smoothly by racket implementation?