Course

Scheme from the ground up

A language of lists, where the code is the data

  • Beginner
  • 12 chapters
  • 218 min read

Learn Scheme by writing it: brackets and prefix notation, names and values, decisions, the list that everything is built from, functions you define yourself, recursion in place of loops, loops that carry an accumulator, map and filter, symbols and little tables, text, vectors and private state, ending with a small library that uses all of it.

What You'll Learn

  • Read and write prefix notation, and print with print and display
  • Name values with define and let, and ask a value what it is
  • Choose between branches with if and cond, using the truth rule
  • Build and take apart lists with cons, car, cdr, append and reverse
  • Define your own functions with lambda and the bracketed define
  • Solve problems by recursion, with a stopping case that ends the walk
  • Write a named let loop and carry an accumulator through it
  • Replace hand-written walks with map, filter, apply and for-each
  • Use symbols as keys, and tell eq? apart from equal?
  • Cut, join and convert text, including the number conversions
  • Update a vector in place, and keep state private inside a function
  • Compose a small library from records, lookups and formatted output

Prerequisites

  • No programming experience needed — this course starts at the first bracket
  • Any other language you know will make the early chapters quick

Course Content

  1. 01
    Your first Scheme

    What Scheme is, why the operation comes first, and the two ways to write something out: print and display.

    Beginner · 14 min read

    Not started
  2. 02
    Names for values

    Naming a value with define, local names with let, asking a value what it is, and the one way a name can change.

    Beginner · 15 min read

    Not started
  3. 03
    Deciding with if and cond

    Two truth values, the rule that only one of them is false, and the two ways to choose between branches: if and cond.

    Beginner · 16 min read

    Not started
  4. 04
    Lists, the big idea

    The one structure Scheme is built from: how a list is put together with cons, how to take it apart with car and cdr, and how to walk it.

    Beginner · 17 min read

    Not started
  5. 05
    Making your own words

    Lambda, the two ways to name a function, local helpers, and the idea that a function is a value you can hand to another function.

    Intermediate · 18 min read

    Not started
  6. 06
    Recursion instead of loops

    A function that calls itself, the stopping case that ends it, and the same three-line shape for every walk down a list.

    Intermediate · 20 min read

    Not started
  7. 07
    Loops you can read

    The named let, which is a loop made of a function, and the accumulator pattern for building a list in order.

    Intermediate · 18 min read

    Not started
  8. 08
    Map, filter and friends

    The built-in helpers that replace most hand-written walks: map to change every value, filter to keep some, apply to spread a list into a call.

    Intermediate · 18 min read

    Not started
  9. 09
    Symbols and little tables

    Names used as plain data, the difference between comparing identity and comparing contents, and tables built from pairs.

    Advanced · 20 min read

    Not started
  10. 10
    Text, taken apart

    Strings from the inside: cutting them up, joining them, changing their case, and the two conversions that let text join in the arithmetic.

    Advanced · 18 min read

    Not started
  11. 11
    Change, and vectors

    The two kinds of change in Scheme: repointing a name with set!, and updating a slot in a vector — plus the closure that keeps state to itself.

    Advanced · 20 min read

    Not started
  12. 12
    A small library, end to end

    An address book built from everything in the course: records, a table lookup, a recursive walk, text formatting, and one controlled escape.

    Advanced · 24 min read

    Not started