Hey everyone! During my office hours this week, I’ve noticed some people having several common issues with DrRacket. Here are a few tips that might help you out:
Use esc-p in the Interactions window to bring back code you have already run: Reusing code you have previously evaluated can save you lots of extra typing. This is particularly useful if you make a typo (like an extra letter or missing parenthesis) and want to bring back your last command to modify it slightly. (On Windows, alt-p also works for this.)
Press tab to automatically indent your code: Pressing the tab key on any line in the Definitions window (the top one) will automatically indent that line of code based on the code around it. This not only makes programs more legible, but can also help you understand what code is being evaluated in what order. If the automatic indenting looks odd, it is often a sign that you are missing a parenthesis.
Use the Definitions window (the top half of DrRacket) for large amounts of code and the Interactions window (bottom half) for testing and experimentation: The Interactions window is great for seeing how certain procedures behave and for running the code you have written, but it makes working on large pieces of code difficult. Make sure you work on your definitions and procedures in the Definitions window, then use the Interactions window only to run them.
Make sure you click Run every time you change your code: Whenever you run one of your procedures in the Interactions window, DrRacket uses the version of the procedure that you had in the Definitions window the last time you pressed Run. This means that you need to press Run every time you make a new change to your code in order to use that new code in the Interactions window. If you think you fixed a problem but keep getting an error, you may have forgotten to click Run. A keyboard shortcut for Run is ctrl-t.
If you have any additional DrRacket-related questions or discover any useful features, please leave a comment!
-Jonathan
Recent Comments