DOC PREVIEW
UW CSE 341 - Using Racket and DrRacket

This preview shows page 1 out of 2 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Using Racket and DrRacket in CSE 341Fall 2011Last updated: October 28, 2011OverviewFor the middle portion of the course, we will be using the Racket language (instead of the SML language)and the DrRacket programming system (instead of emacs). This document describes basic installation andusage steps sufficient for doing your homework.The main website for Racket-related things is http://racket-lang.org. See in particular The RacketGuide at http://docs.racket-lang.org/guide/index.html.InstallationAll you need is the DrRacket system.• You can download DrRacket for your own machine from http://racket-lang.org/download andfollow the installation instructions.• DrRacket should be installed on the machines in the department lab.First Time Set-UpThe first time you use DrRacket, click on “Choose Language” in the lower left and then select “Use thelanguage declared in the source.” DrRacket should remember this choice henceforth.Structure of your Racket files• Create and save programs in the (top) “Definitions Window.” You can save your file wherever. Use a.rkt file extension.• Make the first line of your file exactly (including the # character):#lang racketThis tells DrRacket that your file is in the Racket language and not some other language. You canhave lines of comments before this line.• For your homework solution, make the second non-comment line of your file:(provide (all-defined-out))This line is, at least for the time being, working around Racket’s module system. In Racket, each fileis its own module and this line is making all top-level definitions externally visible, which is not thedefault. You do not need this line to use your definitions in the REPL (the bottom buffer). You doneed this line (or another approach) to use your definitions from a second testing file.1• For a second testing file, also include the #lang racket line and then include the line(require "foo.rkt")where foo.rkt is the file with the code you want to test. Put both files in the same directory/folderon your computer. Your testing file does not need (provide (all-defined-out)).Using DrRacketFor the most part DrRacket is an easy-to-use system with lots of documentation. Here are a few specificnotes related to how we will use it:• Click “Run” to have the REPL process the definitions in your file.• Clicking “Run” will “start the REPL over” — all previous work will disappear and only the definitionsfrom the file you “Run” will be defined.• If you want to save work in the REPL, do so before clicking “Run.” There is also an option under“File” for “Log Definitions and Interactions” but we have little experience with it.• A useful shortcut in the REPL is to use Alt-P (any number of times) to bring back up recent interac-tions. Moreover, this works even to bring up interactions from before the most recent “Run.” Thatis, even though the interactions disappeared and are not part of the current environment, you can stilluse Alt-P to bring them back and then edit them or click Return to re-run them.• When using a second testing file as described in the previous section, click “Run” in the window thathas the testing file. This will send to the REPL your homework solution and your tests.• If you cause an infinite loop, click “Stop.”• You can (re-)indent a line with the TAB key. You can select multiple lines and hit TAB to reindentall selected lines.• If you type ), DrRacket will replace it with ] if doing so will match a


View Full Document

UW CSE 341 - Using Racket and DrRacket

Documents in this Course
Macros

Macros

6 pages

Macros

Macros

6 pages

Macros

Macros

3 pages

Mutation

Mutation

10 pages

Macros

Macros

17 pages

Racket

Racket

25 pages

Scheme

Scheme

9 pages

Macros

Macros

6 pages

Load more
Download Using Racket and DrRacket
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Using Racket and DrRacket and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Using Racket and DrRacket 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?