Skip to content
Tutorials Center
My learning

Topics

Racket and Scheme Tutorial

Learn Racket and Scheme step by step: 38 lessons in 9 chapters with examples, quizzes, diagrams and projects.

Start learning →

of lessons completed

Getting Started

  1. 1 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.
  2. 2 Installing Racket and Running Your First Program Install Racket, open DrRacket, write a #lang racket program, and run it from the editor or the command line. Includes how files and modules are laid out.
  3. 3 The REPL and Developer Tools Use the Racket REPL and DrRacket effectively: interactive evaluation, the stepper, error messages, printing values, comments, and the raco command-line tools.
  4. 4 Racket, Scheme Dialects and the Ecosystem A map of the Scheme and Racket world: the R5RS, R6RS and R7RS standards, major implementations, the Racket package catalog, and how to choose where to start.

Syntax and Evaluation

  1. 5 S-expressions and How Evaluation Works Learn how Lisp code is built from S-expressions and how the evaluator reduces them: atoms, lists, the substitution model, special forms and the quote operator.
  2. 6 Numbers and Booleans Work with numbers and booleans in Racket and Scheme: the numeric tower, exact versus inexact values, arithmetic and comparison functions, and truthiness rules.
  3. 7 Defining Names with define and let Bind names to values with define, let, let* and letrec in Racket and Scheme. Learn lexical scope, shadowing, internal definitions and when to use set!.
  4. 8 Strings, Characters and Symbols Learn the text types of Racket and Scheme: strings, characters and symbols. Includes string functions, conversion, comparison and when to use a symbol.
  5. 9 Conditionals: if, cond, case, when and unless Make decisions in Racket and Scheme with if, cond, case, when and unless. Learn else clauses, the => form, predicates, and how to write clear nested conditions.

Lists and Recursion

  1. 10 Pairs and Lists Understand the pair, the building block of Lisp lists. Learn cons, car, cdr, list, quote, dotted pairs, list functions and why lists are linked chains.
  2. 11 Recursion Basics Learn recursion in Racket and Scheme: base cases, recursive steps, factorial, Fibonacci, accumulators, tracing calls with the substitution model, and common mistakes.
  3. 12 Recursion on Lists: Patterns Master the list recursion template in Racket and Scheme: empty case, first and rest, sum, filter, map, append, reverse, nested lists and tree recursion.
  4. 13 Association Lists and Hash Tables Store key-value data in Racket and Scheme with association lists and hash tables: assoc, hash, make-hash, hash-ref, hash-set, counting words and choosing between them.
  5. 14 Vectors and Structs Use vectors for fast indexed access and structs to define your own record types in Racket. Covers vector-ref, vector-set!, struct fields, transparency and pattern matching.

Higher-order Functions

  1. 15 Lambda and Closures Learn anonymous functions with lambda, functions as values, and closures that remember their surroundings. Build counters, adders and private state step by step.
  2. 16 map, filter and fold Replace hand-written recursion with map, filter, foldl, foldr, andmap and ormap in Racket. Learn argument order, building pipelines and how fold generalizes list recursion.
  3. 17 Function Composition and Currying Build small functions into bigger ones with compose, curry and partial application in Racket and Scheme. Write your own helpers and see functions that make functions.
  4. 18 apply, Variadic Functions and Optional Arguments Write functions that accept any number of arguments in Racket and Scheme: rest parameters, apply, optional and keyword arguments, and a small statistics toolkit.

Continuations and Tail Calls

  1. 19 Tail Calls and Loops Learn tail position, proper tail calls, named let and why Scheme and Racket have no loop keyword. Includes runnable JavaScript stand-ins that show the stack problem.
  2. 20 Accumulators and Trampolines Turn non-tail recursion into tail recursion with accumulators, see how reverse fixes list building, and learn trampolines for languages without tail-call support.
  3. 21 call/cc and Escapes Understand continuations: what the rest of the computation is, how call/cc captures it, early exit from loops, and runnable JavaScript stand-ins for escaping continuations.
  4. 22 Generators and Coroutines Build generators and coroutines from continuations, use Racket's racket/generator library, and model the same ideas with JavaScript generators in runnable stand-ins.

Macros and Languages

  1. 23 Quote and Code as Data Learn why Lisp code is just lists: quote, quasiquote, unquote, eval and namespaces, plus runnable JavaScript stand-ins that treat programs as nested arrays.
  2. 24 Syntax-rules Macros Write pattern-based macros with define-syntax-rule and syntax-rules: patterns, templates, ellipses, literals, recursive macros, and a JavaScript pattern-expander stand-in.
  3. 25 Hygiene and syntax-case Understand hygienic macros and variable capture, then move to syntax-case, with-syntax and syntax-parse in Racket, with a runnable JavaScript capture demo and renaming stand-in.
  4. 26 Languages with #lang See how Racket's #lang line selects a language, how a module language is built from provide and macros, and run a JavaScript stand-in for a tiny reader plus evaluator.

Modules and Contracts

  1. 27 Modules and provide Organize Racket programs into modules: require and provide, rename and prefix imports, submodules like main and test, collections and paths, plus a JavaScript module-registry stand-in.
  2. 28 Contracts Basics Learn Racket contracts: -> and contract-out, predicates and combinators like or/c and listof, blame at module boundaries, and a JavaScript contract-wrapper stand-in.
  3. 29 Structs and Contracts Define Racket structs, guard fields with contracts, use struct-out and #:transparent, immutable updates with struct-copy, and run a JavaScript record validator stand-in.
  4. 30 Testing with rackunit Write tests with rackunit: check-equal?, check-true, check-exn, test-case and test-suite, the test submodule and raco test, plus a runnable JavaScript mini test framework stand-in.

Applications

  1. 31 Text Processing and Ports Read and write files with Racket ports, process lines and words, use regexps and string functions, and run a JavaScript text-pipeline stand-in with a string port model.
  2. 32 Web Servers and Servlets Build web apps with Racket's web-server: request and response structs, dispatch-rules routing, X-expressions for HTML, forms, and a JavaScript routing and templating stand-in.
  3. 33 Concurrency and Places Compare Racket's green threads, channels, synchronization with sync, futures and places for parallelism, with runnable JavaScript stand-ins for channels and a worker pool.
  4. 34 Drawing with pict Create graphics as values in Racket with the pict and 2htdp/image libraries: shapes, hc-append, vc-append, recursion for fractals, and a runnable SVG-generating JavaScript stand-in.

Projects and Practice

  1. 35 Project: A Mini Scheme Interpreter Build a small Scheme interpreter: tokenizer, parser, environments, closures, if, define, let and tail calls. Racket version read-only, a full runnable JavaScript version included.
  2. 36 Project: A Pattern Matcher Learn Racket's match form, then build your own pattern matcher with variables, wildcards, list patterns and ellipsis rules, and use it to write a symbolic differentiator.
  3. 37 Practice: Recursion Problems Eight practice problems on recursion, accumulators, tail calls and higher-order functions, each with a Racket solution, hints, and runnable JavaScript checks to compare against.
  4. 38 Practice: Macros and Course Review Practice macros, continuations, contracts and modules with exercises and solutions, a runnable macro-expander challenge, and a final review of the Racket and Scheme course.