Racket Software Setup

For the second portion of the course, we will be using the Racket language (instead of the OCaml language) and the DrRacket programming system (instead of VS Code).  This document describes basic installation and usage steps sufficient for doing your homework.

The main website for Racket-related things is http://racket-lang.org.  See in particular The Racket Guide .  There is also The Racket reference.

Installing DrRacket

All you need is the DrRacket system. 

Download DrRacket and follow the installation instructions.  

First Time Set-Up

The first time you use DrRacket, copy this line into the file:

#lang racket  

Now, click the Run button near the top, and then confirm that the bottom left says, ``Determine language from source.''  If not, click on it to choose this option.  DrRacket should remember this choice henceforth.  This means the first line of the file determines the language and our first line will always be 

#lang racket  

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.

#lang racket

This 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 (all-defined-out))

This line is working around Racket's module system.  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 "foo.rkt")

where foo.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)).

Using DrRacket

For the most part, DrRacket is an easy-to-use system with lots of documentation.  Here are a few specific notes related to how we will use it: