source code: https://github.com/AlexKnauth/debug
A racket lang-extension for debugging, based on sugar/debug.
1 #lang debug
A lang-extension (like at-exp
) that allows for quick debugging
shorthands to a program written in any racket-based language that looks at the
To debug the value of an expression, simply put debug in front of the language
at the top of the file (for instance #lang debug
racket), and put #R, #RR or #RRR
in front of the expression.
#R reports the value and returns it
#RR reports the value with a line number and returns it
#RRR reports the value with the file and line number, and returns it
Creates a repl for debugging, which can access local variables in the context
where it is used.
Will be able to access the x
local variables (if
debugging information is enabled in DrRacket’s
window, or if the program was executed using
racket -l errortrace -t myprogram.rkt
It becomes much more useful in a function definition:
Then if you call (f 1 2), it will create a repl where x is
1 and y is 2.
In one of these repls, you can try evaluating different expressions. If you’re
debugging a higher-order function for example, you can try out the functions
it accepts or creates with multiple sets of arguments to see how they react.
(resume v ...) → any
| v : any/c|