Basically you can implement a set! without set !, but I donβt think you can implement set-car! / set-cdr! without mutation pairs or simulating pairs (for example, an example of co-assembly)
Since it seems that you are doing your implementation of the Scheme on the Scheme, I would use set-car! / Set-cdr! implement it in the interpreter or simply not implement them at all. I would start by defining if, quote, pair ?, eq ?, cons, car, and cdr (similar to LISP Roots , but more schematically) to have a basic minimal implementation to start with, and then further improve it.
In any case .. Your implementation, if you implement it, should be able to do this:
(define odds (list 1 3 5 7 9 11)) (set-car! (cddr odds) #f) odds ===> (1 3 #f 7 9 11)
source share