debug
1 #lang debug
2 debug-repl
debug-repl
8.12

debug🔗ℹ

source code: https://github.com/AlexKnauth/debug

A racket lang-extension for debugging, based on sugar/debug.

1 #lang debug🔗ℹ

 #lang debug package: 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 readtable.

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.

Examples:
#lang debug racket
#R(+ 1 2)
;(+ 1 2) = 3
;3

#lang debug racket
(+ 1 2 #R(* 3 4))
;(* 3 4) = 12
;15

2 debug-repl🔗ℹ

 (require debug/repl) package: debug

syntax

(debug-repl)

Creates a repl for debugging, which can access local variables in the context where it is used.

For example a (debug-repl) in a let form
(let ([x 1] [y 2])
  (debug-repl))
Will be able to access the x and y local variables (if debugging information is enabled in DrRacket’s Choose Language window, or if the program was executed using racket -l errortrace -t myprogram.rkt).

It becomes much more useful in a function definition:
(define (f x y)
  (debug-repl))
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.