On this page:
1 Installation
2 Programming Basics
3 Racket Style
4 The Design Recipe

Racket Basics and Style

Last updated: Tue, 10 Oct 2023 11:33:10 -0400

This page gives a basic introduction to the Racket programming language.

The Racket documentation and the Textbook include many more details and will be useful resources this semester.

1 Installation

See Racket’s "Getting Started Page"

2 Programming Basics

3 Racket Style

To be readable, all code should be written according to an accepted list of style guidelines.

In this course, we will use the Racket Style Guide.

Here are a few conventions that we’ll use more frequently:

  1. Spacing: Closing parentheses do not go on their own line.

  2. Spacing: Indentation matters. When in doubt, use DrRacket’s auto-formatter.

  3. Code Organization: provides and requires go at the top of the file (provides first).

  4. Brackets have the same meaning as parens but for readability, we will use them in some situations, e.g., around cond clauses.

  5. Comments: double semicolon for full-line comments, single for partial line.

  6. Naming: Predicate (function that returns a boolean) names have a ? suffix, e.g., string?.

  7. Naming: multi-word identifiers, e.g. string-append, use - as the separator (not underscore or camelCase)

  8. No "magic numbers". Define constants instead.

  9. Naming: All constants must be named with an all-caps identifier.

4 The Design Recipe

All code in this class must follow The Design Recipe.