Skip to content
Tutorials Center
My learning

Topics

Lesson 1 of 38 ยท Getting Started

What Are Scheme and Racket?

Meet Scheme and Racket, two small, elegant Lisp languages: where they come from, what makes them special, and why learning them changes how you program.

Scheme is a small programming language with a very big reputation. It was designed in the 1970s at MIT as a minimal dialect of Lisp: just a handful of rules, yet powerful enough to express almost any idea in computer science. Racket is a modern descendant of Scheme that grew into a full "language workbench" with a huge standard library, a friendly editor, and tools for building entirely new languages.

You will meet both in this tutorial. Most of the ideas apply to both, and where they differ we say so. Learning a Lisp is one of the best ways to understand what programming languages actually do, because there is so little syntax standing between you and the ideas.

Honest note about the runnable examples. Real Racket and a real Scheme interpreter cannot run inside this website. The code you see in racket blocks is real and correct Racket; where you can press Run, the page uses a small Scheme interpreter written in JavaScript for this course. It is a teaching stand-in: it understands the core of the language (lists, define, lambda, let, recursion, tail calls, simple macros), but not modules, continuations, rational numbers, or most of the Racket library. Each lesson says when something is real-Racket-only.

A very short history

  • 1958: John McCarthy invents Lisp ("LISt Processor") at MIT.
  • 1975: Gerald Sussman and Guy Steele create Scheme, keeping Lisp's ideas but adding lexical scope and treating functions as ordinary values.
  • 1990s: Scheme becomes a favorite teaching language; the textbook Structure and Interpretation of Computer Programs made it famous.
  • 1995: PLT Scheme starts as a teaching project. In 2010 it was renamed Racket to show it was now its own language.
  • Today: Racket is maintained by a community of researchers and teachers. The Scheme world has standards called R5RS, R6RS and R7RS.

What makes these languages special

Four big ideas

Code is data Programs are lists you can build and inspect.
Functions are values Pass them, return them, store them.
Recursion first Loops are just calls in tail position.
Macros Add new syntax to the language itself.

The rest of this course digs into each one.

1 / 2
  1. Uniform syntax. Everything is written as a parenthesized list: (function argument ...). There is no operator precedence to memorize. (+ 1 (* 2 3)) is unambiguous.
  2. Code is data. A program is just a nested list, and you can build and take apart lists with the same functions you use for any other data. This is why Lisp macros are so powerful.
  3. First-class functions. A function is a value like a number. You can pass + to another function or return a new function from one.
  4. Small core. The Scheme report (R7RS) is a few dozen pages. Racket has a much larger library but the same small heart.

Scheme versus Racket

Scheme Racket
What it is A family of languages with a standard One language and a large ecosystem
Implementations Chez, Guile, Chicken, Gambit, MIT/GNU, Chibi... Racket itself (with Racket CS as the engine)
Size Tiny core, libraries vary Batteries included: GUI, web server, plotting, test framework
Typical use Teaching, embedding, compilers research Teaching, language design, scripting, applications
Pairs Mutable Immutable by default (mcons for mutable)

A Racket program usually starts with a #lang line that names the language it is written in:

RACKET
#lang racket

(displayln "Hello from Racket")

Because the language is chosen per file, Racket can host many languages: #lang racket/base for a lean version, #lang typed/racket for static types, #lang scribble/manual for documentation, even #lang r5rs for classic Scheme. You will build one in the chapter on macros and languages.

Your first taste

The classic first idea in a Lisp is that function calls put the function first. Here is the same arithmetic you know, in prefix form. The <pre> below shows what the stand-in interpreter prints, in the same style the Racket module prints values.

Prefix notation

Notice (+ 1 2 3 4 5): because + is just a function, it can take any number of arguments. Try changing a number, or add (display "hi") as a new line and press Run.

Programs that write programs

One more teaser. In Lisp, a quote mark ' turns code into data. This lets a program treat an expression as a list:

Code as data

expr is a list of four things: the symbol + and three numbers. You can take it apart with car and cdr like any other list. Later you will write a function that evaluates such lists, which is the heart of an interpreter.

Where Lisp ideas live today

Closures, map/filter/reduce, garbage collection, REPLs, and even the if expression all came from the Lisp family. JavaScript, Python, Ruby, Rust and Swift all borrow from it. When you learn Racket, you meet those ideas in their purest form.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does the (+ 1 2 3) syntax tell you about Lisp function calls?

    Every call is written as (function arg ...). Because + is an ordinary function, it can take any number of arguments.
  2. 2. Which statement about Racket is true?

    Racket began as PLT Scheme and was renamed in 2010. Racket is designed for building languages, and typed/racket is just one of them.
  3. 3. What does the #lang line at the top of a Racket file do?

    #lang selects the language, for example racket, racket/base or typed/racket.
  4. 4. What does the course use to run examples in the browser?

    Racket cannot run on the site, so the lessons use a teaching interpreter and say so wherever behaviour differs.

Summary

  • Scheme is a minimal Lisp; Racket is a modern, batteries-included descendant built for teaching and language design.
  • Everything is a parenthesized list with the function first: (+ 1 2).
  • Code is data, functions are values, and recursion and macros are central.
  • #lang chooses the language a file is written in.
  • Runnable examples in this course use a JavaScript stand-in interpreter; real Racket code is shown read-only.

Next: Installing Racket and Running Your First Program