3 ms·
Sometimes a break-loop is all you have. But usually there is something around it. Typically a Lisp system can run several REPLs at the same time, one might be
by lispm 3y ago
Sometimes a break-loop is all you have.
But usually there is something around it. Typically a Lisp system can run several REPLs at the same time, one might be a break loop. You can define a function in another REPL and use it in the break-loop. You can define the function by loading code in a break-loop.
An interaction might be (here in LispWorks):
CL-USER 6 > (> (sin-x2 3) 0)
Error: Undefined operator SIN-X2 in form (SIN-X2 3).
1 (continue) Try invoking SIN-X2 again.
2 Return some values from the form (SIN-X2 3).
3 Try invoking something other than SIN-X2 with the same arguments.
4 Set the symbol-function of SIN-X2 to another function.
5 Set the macro-function of SIN-X2 to another function.
6 (abort) Return to top loop level 0.
Type :b for backtrace or :c <option number> to proceed.
Type :bug-form "<subject>" for a bug report template or :? for other options.
CL-USER 7 : 1 > (load "~/sin-x2.lisp")
; Loading text file /Users/foo/sin-x2.lisp
#P"/Users/foo/sin-x2.lisp"
CL-USER 8 : 1 > :c 1
T
A function SIN-X2 does not exist. There is an error and we get a break-loop. The break-loop is one level deep. All of Lisp is available in a break-loop: the compiler, the code loader, the evaluator, ... Lisp stays with the break-loop in the context of the error.
I define/write the function in a file and the load the file. Loading the makes the function available in the running Lisp.
Then I use the continue restart to try to find the function again -> the error is gone