The Common Lisp debugger, in particular, is not part of Scheme (or at least the Scheme standards). CL is designed around interactivity in a way that Scheme is not and the interaction I describe next is a good example of that:
Try doing the Scheme equivalent of this CL code and REPL interaction:
;; in a source file
(defun simulate (instructions)
(let ((state 0))
;; this is based on an AoC problem I recently did
(loop for (op val) in instructions
finally (return state)
do
(ecase op
))))
;; in the REPL
(simulate '((inc 5)))
Note that nothing happens in that case expression right now. It will error out and send you to the debugger. Without selecting an option in the debugger, go back to the code and change it to this:
(defun simulate (instructions)
(let ((state 0))
;; this is based on an AoC problem I recently did
(loop for (op val) in instructions
finally (return state)
do
(ecase op
(inc (incf state val))))))
Recompile that code in the source file, and then tell the debugger to restart. Now it works and correctly returns 5 as a result.
You can also do this much deeper in a program (I actually implemented the Advent of Code "virtual machine" this way). It doesn't restart the entire program, only the offending bit.
(NB: All code written in the HN comment field, not actually tested so I may have mistyped something, should be correct though.)
To the best of my knowledge, that sort of interaction is not standard in Scheme implementations.
Try doing the Scheme equivalent of this CL code and REPL interaction:
Note that nothing happens in that case expression right now. It will error out and send you to the debugger. Without selecting an option in the debugger, go back to the code and change it to this: Recompile that code in the source file, and then tell the debugger to restart. Now it works and correctly returns 5 as a result.You can also do this much deeper in a program (I actually implemented the Advent of Code "virtual machine" this way). It doesn't restart the entire program, only the offending bit.
(NB: All code written in the HN comment field, not actually tested so I may have mistyped something, should be correct though.)
To the best of my knowledge, that sort of interaction is not standard in Scheme implementations.