How to find the definition of functions?

Hi, I am a rookie to Racket. Recently I am debugging a Racket program, which depends on several other packages. I found it difficult to locate the definition for each function. The only way I know is using "trace". But that is not so convenient since I need to first change "define" to "trace-define". Is there any easy way to quickly find the location of function definitions? Thanks!

2 Likes

What editor are you using?

If you're using DrRacket, you can right-click on an identifier, and often you will have a context-menu item "Open defining file". And if this file is already open in DrRacket, you may even have on right-click "Jump to definition (in other file)".

3 Likes

Thanks! I was working with command line, and did not realize DrRacket is so powerful!

Similarly, vim with LSP support (e.g., via ALE) and racket-langserver can jump to definition.

4 Likes