Introductory R7RS Scheme

Layer 1: enough Scheme to solve basic exercises.

This course layer teaches the core ideas needed before attempting introductory Scheme exercise sets: expressions, definitions, conditionals, symbols, lists, recursion, growth, tail calls, higher-order procedures, data abstraction, and hierarchical data.

Available Lessons

Scope

This is a concrete starting layer, not a complete course. It is designed to prepare readers for early exercises from classic Scheme introductions while using explicit R7RS imports and tested examples.

What This Layer Must Cover

First Tested Example

The current checked example sources are published at /examples/r7rs/intro/lesson-01/, /examples/r7rs/intro/lesson-02/, /examples/r7rs/intro/lesson-03/, /examples/r7rs/intro/lesson-04/, and /examples/r7rs/intro/lesson-05/. They check definitions, conditionals, simple recursion, list operations, higher-order procedures, local binding, tail recursion, growth examples, constructors, selectors, data abstraction, and tree mapping.

(import (scheme base)
        (scheme write)
        (scheme process-context))

(define (square-number n)
  (* n n))

(define (rectangle-area width height)
  (* width height))

(define (factorial n)
  (cond
    ((or (not (integer? n)) (< n 0))
     (error "factorial: expected a nonnegative integer" n))
    ((<= n 1) 1)
    (else (* n (factorial (- n 1))))))

The full checked files add assertions around these definitions. The CHICKEN command currently used for local verification is:

scripts/test_examples_chicken.sh

Exercise Readiness

After this layer, a reader should be ready for early exercises involving arithmetic expressions, predicates, list selectors, symbolic data, simple recursion over lists, tail-recursive loops, growth estimates, and small procedure definitions. More advanced exercise sets require later layers on trees, abstraction, local binding, mutation, macros, and interpreters.

Related References