4

When you get an error in MIT scheme it doesn't tell you where the error occurred. For example, it just prints something like this:

;Unbound variable: top-left
;To continue, call RESTART with an option number:
; (RESTART 3) => Specify a value to use instead of top-left.
; (RESTART 2) => Define top-left to a given value.
; (RESTART 1) => Return to read-eval-print level 1.

How do I find where this error occurred in my code?

user2355213
  • 447
  • 4
  • 13
  • It does, actually, tell you where the error is. It is telling you that `top-left` does not exist. You can search through your code to see where that is being referenced. – C. K. Young Nov 15 '14 at 18:03
  • 1
    Yes, although if you reference top-left several times, then you don't know which one is causing the problem. – user2355213 Nov 16 '14 at 19:55
  • 1
    If it doesn't exist, then it would be the first reference. – Steven Spasbo Dec 24 '14 at 20:16
  • it's pretty late but I'll just leave a comment here just in case someone need it. I got this same problem evaluating the Scheme code with `C-x-e` in `evil mode`. Turns out because I was in `normal mode` and `C-x-e` just evaluating the code before the cursor so it was missing the last parenthesis. So I just turn to `insert mode` and move the cursor to the last position and it worked like a charm. yeah I know, it's a newbie mistake. – Danh Le Aug 03 '23 at 11:01

1 Answers1

2

In mit-scheme, if you are using the REPL from a shell, you can call debug to get the debugger. If you are using the edwin editor. It comes with it's own debugger. Edwin debug. Neither will tell you the line of code in a file where the error occurred if that is what you want. But they provide plenty of information, and facilities to find the problem. Both links are to the Documentation with a good explanation on how to use them.

Flux
  • 9,805
  • 5
  • 46
  • 92
Rptx
  • 1,159
  • 1
  • 12
  • 17