Open DataSnake opened 2 years ago
Thanks for the PR!
You said that:
Fixed a bug in the require statement for racket:random
Can I ask what issue did you encounter that make you think that this is a "bug"? I agree that only-in
seems more appropriate, but rename-in
should work too, right?
I will have to take a look at the book to be sure if other changes look alright.
Let me also ping @soegaard in case he sees anything.
Can I ask what issue did you encounter that make you think that this is a "bug"? I agree that only-in seems more appropriate, but rename-in should work too, right?
When you open main.rkt in DrRacket with the rename-in
line in place, hovering the mouse over anything imported from racket will draw arrows to both that line and the #lang racket
line at the top, and the tooltip will say that it has two binding occurrences. I was curious about that, so I looked at it with the macro stepper, and (require (rename-in racket [random racket:random]))
expands to (#%require (all-except racket random) (rename racket racket:random random))
. It still works as far as I can tell, but it seems wasteful to re-import a bunch of things that were already being provided by the language.
Fixed a bug in the require statement for racket:random and changed inc and dec to use built-in functions that did the same thing instead of being defined from scratch.
Added apply-in-underlying-scheme because the book's solution of just using the line (define apply-in-underlying-scheme apply) at the start of the metacircular evaluator isn't compatible with how Racket handles definitions.
Changed the way set! is handled so that Exercise 4.45 can be completed successfully. If there's an amb statement active, calls to set! will modify amb-fail so that backtracking will undo assignments. This only kicks in if the amb tree isn't currently empty, so it should have no discernible performance impact on programs that don't use amb operations.
Added the user-initial-environment primitive so that the code for the query system in Section 4.4.4 can be run as-is.