Cloud Parts

Racket

A descendant of Scheme built for language-oriented programming: every module names its language on a #lang line, and new languages are just libraries.

What it is
Programming languages (compiled to machine code),Functional programming
Type
Open source
Made by
Racket team (PLT)
License
MIT or Apache 2.0, at your option
Facts checked
8 October 2026

What it is

Every Racket module starts with a #lang line that names the language the rest of the file is written in: #lang racket for the main language, #lang typed/racket for its statically typed sibling, a teaching language for beginners, or a domain-specific language someone wrote. A language is itself a module that exports syntax and functions, so it can add features to an existing language, remove them, or even change what function application means. Macros, built on Scheme’s hygienic macro system, are the everyday tool for this.

Racket CS, the default implementation since Racket 8.0 (February 2021), uses Chez Scheme as its core compiler and runtime. Compiled modules (.zo files) contain machine code for the operating system and processor, not bytecode. The older implementation, Racket BC (“before Chez”), stored platform-independent bytecode and compiled it to machine code just in time. Racket comes with DrRacket, an IDE that grew out of the project’s teaching roots.

Why teams pick it

  • Language-oriented programming: build a small language for a problem and use it from ordinary Racket modules through #lang
  • A spectrum of safety in one system: Typed Racket, Racket with contracts, plain Racket and unsafe foreign calls can be mixed module by module
  • Ahead-of-time compilation to machine code through Chez Scheme, which made Racket faster and easier to maintain than the old bytecode implementation
  • Built for teaching from the start: beginner languages and the DrRacket IDE were the project’s first goals

Watch out for

  • The syntax extension system makes experts very productive but has, in its own designers’ words, an extraordinarily steep learning curve and some brittle corners
  • A new language doesn’t get full IDE support for free: tools such as a stepper take significant extra work
  • Code that calls C through the foreign function interface can behave differently between the CS and BC implementations

Alternatives

What all compiled to machine code have in common →

Adding a `while` loop to the language with a macro · racket

#lang racket

;; Racket has no `while` loop, so we add one with a macro.
(define-syntax-rule (while condition body ...)
  (let loop ()
    (when condition
      body ...
      (loop))))

(define n 3)
(while (> n 0)
  (displayln n)   ; prints 3, then 2, then 1
  (set! n (sub1 n)))

See it in a real stack

No architecture uses Racket yet. Drop it into the playground and wire it up yourself.Open playground →
Where it came from1995–2021

In 1995 the PLT group (Matthias Felleisen, Robert Bruce Findler, Matthew Flatt, Shriram Krishnamurthi and others) set out to build an outreach project for novice programmers. After a year of watching students in labs, they concluded that nobody could teach Scheme in an hour and then move on to the essence of programming, and that editors like Emacs and vi overwhelmed beginners. They needed teaching languages and a beginner-friendly environment, and built both in Scheme, whose macros helped them experiment with language designs.

Building a large system pushed them past standard Scheme. They added a syntax extension system on top of Scheme’s macros, mechanisms for safe abstractions, and language constructs for managing resources and security. The result, long called PLT Scheme, was renamed Racket with version 5.0 in June 2010, because the word “Scheme” suggested a minimal language it no longer was.

In 2017 the team decided to rebuild Racket on Chez Scheme, which compiles to machine code. After four years of work, Racket CS became the default in version 8.0 in February 2021.

Why it’s built this way

A language for making languages
Programming happens in the context of a problem with its own vocabulary, so the designers wanted programmers to capture that vocabulary as a programming language, starting with their own teaching languages.
Syntax extension beyond Scheme’s macros
Macros alone could extend a language but not restrict or redefine it. Racket’s system defines whole languages, down to the meaning of function application.
Turn system features into language constructs
Running student programs inside their own IDE needed control over resources and security, which Scheme didn’t provide, so Racket made those mechanisms part of the language.
Rebuild on Chez Scheme
Racket BC had a compiler, JIT and runtime written in C. Rebuilding on Chez Scheme, which compiles to machine code, produced Racket CS: faster, and easier to maintain and develop.

Timeline

  1. 1995

    The PLT group starts an outreach project for novice programmers

  2. 2010

    PLT Scheme is renamed Racket with version 5.0, released in June

  3. 2017

    Work begins on running Racket on Chez Scheme

  4. 2021

    Racket 8.0 makes Racket CS the default implementation

Sources6 · facts checked 8 October 2026

Improve this page on GitHub