Racket

Table of Contents

Racket Treelist

The original focus of this file: Racket 8.9 introduced racket/treelist, a persistent sequence backed by an RRB tree. See the 2015 ICFP paper for the underlying data structure.

RRB-Vector paper (2015)

@inproceedings{10.1145/2784731.2784739,
  author    = {Stucki, Nicolas and Rompf, Tiark and Ureche, Vlad and Bagwell, Phil},
  title     = {RRB vector: a practical general purpose immutable sequence},
  year      = {2015},
  isbn      = {9781450336697},
  publisher = {Association for Computing Machinery},
  address   = {New York, NY, USA},
  url       = {https://doi.org/10.1145/2784731.2784739},
  doi       = {10.1145/2784731.2784739},
  booktitle = {Proceedings of the 20th ACM SIGPLAN International Conference
               on Functional Programming},
  pages     = {342--354},
  series    = {ICFP 2015}
}

Basic treelist example

#lang racket
(require racket/treelist)

;; Construction
(define tl (treelist 1 "a" 'apple))

;; Access and update
(treelist-ref tl 0)           ; => 1
(treelist-length tl)          ; => 3
(treelist-add tl "new")       ; appends, returns new treelist
(treelist-set tl 1 "b")       ; replaces index 1, returns new treelist

;; Conversion
(treelist->list tl)           ; => '(1 "a" apple)
(list->treelist '(a b c))

2026 Review: Racket Today

Releases: Racket 8.14 through 8.16 (2025–2026)

Racket follows a biannual release cadence. The 8.14–8.16 window (roughly mid-2025 through early 2026) continued to stabilize Racket CS and advance Rhombus.

Key themes across these releases:

  • Racket CS is now the default and only distribution (CGC build retired)
  • Rhombus syntax layer reaching feature parity with racket on core forms
  • typed/racket type-inference improvements, especially around occurrence typing
  • Performance work on the JIT and GC inside Chez Scheme
  • pkg catalog reliability improvements; raco setup incremental rebuild

Racket CS — Chez Scheme Backend

Racket CS replaced the original Racket VM (C + CGC collector) with Chez Scheme as the runtime. The transition completed with Racket 8.x and is now the default.

Why it matters:

  • Chez Scheme has a mature, generational, parallel GC
  • Tail calls and continuations handled at the Chez level — correct and fast
  • Cross-platform native compilation path (via Chez's compile-program)
  • Interoperability with Chez libraries is possible but uncommon in practice

Trade-offs:

  • Startup time slightly higher than the old VM on very small scripts
  • Foreign-function interface (FFI) goes through Chez's foreign-procedure
  • The chez-scheme source tree is now a submodule of the Racket repo

Rhombus — The Racket2 Language

Rhombus (#lang rhombus) is an experimental language built on the Racket macro and module infrastructure that replaces s-expression syntax with an infix/expression-oriented surface.

Current status (2026):

  • Bootstrapped entirely in Racket; ships with the main distribution
  • Core forms (fun, class, match, import~/~export) are stable
  • Macro system (macro, expr.macro, def.macro) allows Rhombus-native DSLs
  • Standard library coverage is incomplete compared to racket/base
  • Still labelled "experimental" — not recommended for production

A minimal Rhombus snippet:

#lang rhombus

fun greet(name):
  "Hello, " ++ name

fun fib(n):
  match n
  | 0: 0
  | 1: 1
  | _: fib(n - 1) + fib(n - 2)

greet("RacketCon")
fib(10)

The Racket Ecosystem

Package Purpose Status
typed/racket Gradual typing for Racket Stable
web-server HTTP server, servlet model Stable
gui Cross-platform GUI toolkit (wxWidgets) Stable
scribble Documentation language (used for Racket docs) Stable
slideshow Presentation slides as Racket programs Stable
plot 2D/3D plotting Stable
math Numerical and matrix operations Stable
db Database interface (PostgreSQL, SQLite) Stable
rebellion Modern collection library (sorted-set, etc.) Active
rhombus New surface syntax experiment Experimental

Typed Racket in practice

#lang typed/racket

;; Occurrence typing: the type of x narrows inside each branch.
;; After (string? x) is true, the checker knows x : String.
(: stringify (-> (U String Number) String))
(define (stringify x)
  (if (string? x)
      x
      (number->string x)))

;; Polymorphic safe-head: returns #f on empty list (Option = (U A #f)).
;; Gradual typing — the boundary is explicit at (require/typed ...) call sites.
(: safe-head (All (A) (-> (Listof A) (Option A))))
(define (safe-head lst)
  (if (null? lst)
      #f
      (car lst)))

(stringify "hello")    ; => "hello"
(stringify 42)         ; => "42"
(safe-head '(1 2 3))   ; => 1
(safe-head '())        ; => #f

Language Tower Diagram

Racket is a "language-oriented programming" platform: every #lang is a distinct language compiled by the same toolchain. The diagram below shows the inheritance/layering relationship.

diagram-racket-langs.png

Racket vs Other Schemes in 2026

Racket's niche is language-oriented programming — it is less a Scheme implementation and more a platform for building languages. That said, direct comparisons with other Schemes are common.

Criterion Racket CS Guile 3.x Chicken Scheme 5.x
R7RS compliance Partial (via pkg) Core + extensions Full (via egg)
Tail calls Yes (Chez) Yes Yes (CPS transform)
Continuations (call/cc) Full Delimited Full
Native compilation Yes (Chez) AOT (Guile 3) Yes
FFI ffi/unsafe (system foreign) C-level integration
Package ecosystem raco pkg Guix / CPAN-like Eggs
Embedded/scripting Limited Strong (GNU toolchain) Strong (small binary)
Language tower / #lang Best-in-class Limited Limited
Documentation tool Scribble Texinfo Manual
GUI Native wxWidgets None built-in None built-in

Racket's standout strength remains DrRacket (the IDE) and the macro system. Guile is the better choice for embedding in C programs (GNU Emacs, GNU Make). Chicken produces small binaries suitable for systems programming.

RacketCon Conference Series

RacketCon is the annual community conference for Racket users and contributors.

Year Location Notable
2019 Salt Lake City, UT Racket CS announced as future default
2020 Online First virtual edition
2022 Providence, RI Rhombus design discussions
2023 Boston, MA Rhombus macro system deep dives
2024 Seattle, WA (Univ. of Washington) 40 years SICP; Abelson + Sussman
2025 TBD Expected Rhombus stabilization talks

See events/racketcon/ for session notes from attended years.

Pattern Matching — Core Racket Example

#lang racket

;; match is the primary destructuring form in Racket.
;; It compiles to efficient decision trees.

(define (describe-list lst)
  (match lst
    ['()          "empty"]
    [(list x)     (format "singleton: ~a" x)]
    [(list x y)   (format "pair: ~a and ~a" x y)]
    [(list x _ ...) (format "starts with ~a, length ~a" x (length lst))]))

(describe-list '())           ; => "empty"
(describe-list '(42))         ; => "singleton: 42"
(describe-list '(a b))        ; => "pair: a and b"
(describe-list '(1 2 3 4 5))  ; => "starts with 1, length 5"

;; Struct patterns
(struct point (x y) #:transparent)

(define (quadrant p)
  (match p
    [(point (? positive? x) (? positive? y)) 'I]
    [(point (? negative? x) (? positive? y)) 'II]
    [(point (? negative? x) (? negative? y)) 'III]
    [(point (? positive? x) (? negative? y)) 'IV]
    [_                                        'on-axis]))

(quadrant (point 3 4))    ; => 'I
(quadrant (point -1 5))   ; => 'II
(quadrant (point 0 0))    ; => 'on-axis

References

Author: Jason Walsh

j@wal.sh

Last Updated: 2026-04-19 08:29:49

build: 2026-04-20 23:41 | sha: d110973