1.1 Buttons

► |  | Dr Racket: The Racket Programming Environment

1 | Interface Essentials
2 | Languages
3 | Interface Reference
4 | Extending Dr Racket
| Index

▼ | 1 | Interface Essentials

1.1 | Buttons
1.2 | Choosing a Language
1.3 | Editing with Parentheses
1.4 | Searching
1.5 | Tabbed Editing
1.6 | The Interactions Window
1.7 | Graphical Syntax
1.8 | Graphical Debugging Interface
1.9 | The Module Browser
1.10 | Creating Executables
1.11 | Following Log Messages

top ← prev up next →

#### 1.1`` Buttons

The left end of the row of buttons in DrRacket contains a miniature button with the current file’s name. Clicking the button opens a menu that shows the file’s full pathname. Selecting one of the menu entries produces an open-file dialog starting in the corresponding directory.

Below the filename button is a (define ...) button for a pop-up menu of names that are defined in the definitions window. Selecting an item from the menu moves the blinking caret to the corresponding definition.

The Save button appears whenever the definitions window is modified. Clicking the button saves the contents of the definitions window to a file. The current name of the file appears to the left of the Save button, but a file-selection dialog appears if the file has never been saved before.

The Step button—which appears only for the How to Design Programs teaching languages Beginning Student through Intermediate Student with Lambda—starts the Stepper, which shows the evaluation of a program as a series of small steps. Each evaluation step replaces an expression in the program with an equivalent one using the evaluation rules of DrRacket. For example, a step might replace (+ 1 2) with 3. These are the same rules used by DrRacket to evaluate a program. Clicking Step opens a new window that contains the program from the definitions window, plus several new buttons: these buttons allow navigation of the evaluation as a series of steps.

> > > The debugging interface is described further in Graphical Debugging Interface, later in this manual.

The Debug button—which does not appear for the How to Design Programs teaching languages—starts a more conventional stepping debugger. It runs the program in the definitions window like the Run button, but also opens a debugging panel with several other buttons that provide control over the program’s execution.

Clicking the Check Syntax button annotates the program text in the definitions window. It add the following annotations:

- Syntactic Highlighting: Imported variables and locally defined variables are highlighted with color changes. Documented identifiers are hyperlinked (via a right-click) to the documentation page.

- Lexical Structure: The lexical structure is shown with arrows overlaid on the program text. When the mouse cursor passes over a variable, DrRacket draws an arrow from the binding location to the variable, or from the binding location to every bound occurrence of the variable.

  In addition to indicating definite references with blue arrows, DrRacket also draws arrows to indicate potential references within macro definitions. Potential arrows are drawn in purple and annotated with a question mark to indicate uncertainty, because DrRacket cannot predict how such identifiers will eventually be used. Their roles may depend on the arguments to the macro and the context the macro is used in.

  Additionally, right-clicking (or Control-clicking on Mac OS X) on a variable activates a pop-up menu that lets you jump from binding location to bound location and vice versa, α-rename the variable, or tack the arrows so they do not disappear.

- Tail Calls: Any sub-expression that is (syntactically) in tail-position with respect to its enclosing context is annotated by drawing a light purple arrow from the tail expression to its surrounding expression.

- Require Annotations: Right-clicking (or Control-clicking on Mac OS X) on the argument to require activates a pop-up menu that lets you open the file that contains the required module.

  Passing the mouse cursor over a require expression inside a module shows all of the variables that are used from that require expression. Additionally, if no variables are used from that require expression, it is colored like an unbound variable.

  Finally, passing the mouse cursor over a variable that is imported from a module shows the module that it is imported from in a status line at the bottom of the frame.

Check Syntax also runs automatically as you edit your program, and the bottom, rightmost corner of the DrRacket window shows its status. A red dot means that something has gone wrong; move your mouse over the dot to find out what is wrong. Mis-matched parentheses indicates that the buffer’s parens are also mismatched; mouse over the parens for details.

When nothing goes wrong, the colors indicate the stages processing of the program: blue (expanding), purple (computing check syntax information), orchid (updating the editor with the check syntax information), and green (finished).

Also, right-clicking in that area yields a menu that lets you disable (or re-eneable) automatic Check Syntax.

The Run button evaluates the program in the definitions window and resets the interactions window.

The Break button interrupts an evaluation, or beeps if DrRacket is not evaluating anything. For example, after clicking Run or entering an expression into the interactions window, click Break to cancel the evaluation. Click the Break button once to try to interrupt the evaluation gracefully; click the button twice to kill the evaluation immediately.

top ← prev up next →