We'll use DrRacket. It is installed on the windows and linux machines in the undergrad labs, or you can download it for a personal machine. The current version is 6.12. The windows machines have version 6.12. The linux machines have 6.11, which will work as well.
On Windows machines in the lab, DrRacket is here:
Racket / DrRacket
You can also double-click on a saved Racket source file.
On Linux machines in the lab, it is here:
Applications/ Education / DrRacketYou can also start it by typing drracket at a shell prompt, or drracket myfile.rkt to start it on an existing source file.
Finally, you can download it and install it on a personal machine from http://racket-lang.org/download. It's free.
The first time you use DrRacket, click on “Language” in the top menu, then select “The Racket Language.” The text #lang racket should appear in the upper definitions pane, and the bottom left should say “Determine language from source“ Click “Run”.
DrRacket should remember this choice henceforth.
#lang racketThis tells DrRacket that your file is in the Racket language and not some other language. You can have lines of comments before this line.
(provide tuna flounder)Or as a hack, you can work around Racket's module system by making the second non-comment line of your file with function definitions be:
(provide (all-defined-out))In Racket, each file is its own module and this line is making all top-level definitions externally visible, which is not the default. You do not need this line to use your definitions in the REPL (the bottom buffer). You do need this line (or another approach) to use your definitions from a second testing file.
(require "octopus.rkt")where octopus.rkt is the file with the code you want to test. Put both files in the same directory/folder on your computer. Your testing file does not need (provide (all-defined-out)).
Use the "Debug" button to debug programs, and also to understand how recursive functions are operating. Another useful command is "Check Syntax", which of course checks the syntax, but also lets you see the bindings of variables. (Try hovering the mouse over a variable -- good to help understand lexical scoping.)
If you are working on a personal machine not connected to the Internet, installing Racket provides a local copy of the documentation -- the “help” menu item will access it.