Lambda Forever!

Using Dr. Racket

CS 3540

Programming Languages
and Paradigms

The following are helpful hints for using Dr. Racket for coursework and for homework assignments. These pointers apply to most Scheme interpreters and IDEs.

  1. When you want the interpreter to evaluate an expression, enter it in the Interactions window and hit return. You can get to the Interactions window by choosing it from the File menu or by executing the code in the Definitions window.

  2. Dr. Racket lets you know the state of your expression by highlighting the expression surrounded by the parenthesis at your cursor. Just place your cursor to the left of a left parenthesis or to the right of a right parenthesis. This will help you manage "all those parentheses".

  3. Typing return while in the middle of an expression will drop the cursor to the next line, indented in a suitable fashion, and allow you to type more text. But it will not cause Dr. Racket to evaluate the current expression.

  4. You can add a comment to your Racket code by using ;, the semi-colon. All text following a semi-colon is ignored by the interpreter when a file is loaded.

    Comments are intended primarily for code in files. If you type a comment during an interactive session, the interpreter will require you to follow up with a valid expression, even if you had typed one on the line before your comment. For example:

             > 12 ;; comment
               13 ;; comment

  5. At any time, you can save the contents of the your Dr. Racket Interaction window as a plain text file, using options available on the standard File menu. You may find this handy when you would like to take a trace of an interaction when you leave the lab, say, for debugging or for showing your instructor what you've been doing.

Eugene Wallingford .....