Appendices: Projects, Interview Questions, Cheat Sheet & Resources

Capstone projects, interview questions, a Scheme cheat sheet, Scheme for developers coming from other languages, and resources with a study plan.

Appendix A: Capstone Projects

Beginner: List Toolkit. Implement my-map, my-filter, folds, flatten, zip, range, take, drop, and merge sort, with SRFI-64 tests.

Beginner: Rational and Complex Arithmetic. SICP-style abstraction barriers, generic operations with data-directed dispatch.

Intermediate: Symbolic Algebra System. Differentiation, simplification, and pretty-printing of expressions (SICP 2.3 extended).

Intermediate: Huffman Encoder/Decoder. Build Huffman trees from frequencies and encode/decode messages (SICP 2.3.4).

Intermediate: Text Adventure with Records. World state in records and hash tables, a command parser, save/load via write/read.

Intermediate: Stream Library. SICP streams plus SRFI-41-style operations; compute primes, pi approximations, and power series.

Advanced: Metacircular Evaluator. Complete SICP 4.1, add let*, named let, and/or, error handling, and a REPL.

Advanced: amb Puzzle Solver. Implement amb with continuations; solve the multiple-dwelling puzzle, N-Queens, and map coloring.

Advanced: miniKanren. Implement microKanren (~50 lines), then build relations (appendo, membero) and solve logic puzzles.

Advanced: Compiler. Compile a Scheme subset to a stack VM or to C/x86-64 (Ghuloum's incremental approach).

Practice: Guile Web Service. A JSON/REST service with Guile's web server or Artanis, tests, and Guix packaging.

Open Source: Publish a Library. A portable R7RS library with cond-expand, SRFI-64 tests on 3+ implementations, and an Akku/snow package.

Appendix B: Interview Questions

What makes Scheme different from other Lisps? Why is it called minimal?

Explain lexical scoping and closures with an example.

What does "proper tail recursion" mean? Why can loops be written as recursion in Scheme?

Explain eq?, eqv?, equal?, and =.

What is a continuation? What can you build with call/cc?

What is CPS (continuation-passing style), and why do compilers use it?

What does dynamic-wind do, and why is it necessary in a language with first-class continuations?

What are hygienic macros? What problems do they solve? syntax-rules vs syntax-case?

What are delay and force? How do streams work?

Explain let, let*, letrec, letrec*, and named let.

What are multiple values? How do call-with-values and let-values work?

What are parameters, and how do they differ from global variables?

How do R7RS exceptions work (raise, raise-continuable, guard, with-exception-handler)?

What is the metacircular evaluator? Explain the eval/apply cycle and environments.

Describe the environment model of evaluation.

Data-directed programming vs message passing: what are the trade-offs?

What is amb? How does backtracking with continuations work?

What are SRFIs? Name several important ones.

Compare R5RS, R6RS, and R7RS.

Name major Scheme implementations and their strengths.

Write flatten, deep-reverse, and permutations.

Implement fold-left and fold-right, then write map, filter, and reverse with them.

Write a while macro and a hygienic swap! with syntax-rules.

Implement a generator over a list or tree with call/cc.

Implement an infinite stream of primes.

Implement a queue with set-cdr! (O(1) insertion).

Write the Y combinator in Scheme.

Write an evaluator for arithmetic expressions with variables.

Appendix C: Scheme Cheat Sheet

;; ===== Definitions =====
(define x 10)   (define (f a b) (+ a b))   (define (g . args) args)   (define h (lambda (x) x))
(define-record-type point (make-point x y) point? (x point-x) (y point-y set-point-y!))
(define-syntax m (syntax-rules () ((_ a) (list a))))
(define-values (q r) (floor/ 7 2))   (define p (make-parameter 0))

;; ===== Binding =====
(let ((a 1) (b 2)) ...)   (let* ...)   (letrec ...)   (let loop ((i 0)) ... (loop (+ i 1)))
(let-values (((a b) (values 1 2))) ...)   (parameterize ((p 1)) ...)   (set! x 5)

;; ===== Control =====
(if c a b)   (cond (c1 e1) ((assq k al) => cdr) (else e))   (case x ((a b) 1) (else 2))
(when c ...)   (unless c ...)   (and ...)   (or ...)   (not x)   (begin e1 e2)
(do ((i 0 (+ i 1))) ((= i 5) 'done) body)

;; ===== Lists =====
(cons a b) (car p) (cdr p) (list 1 2) (append l1 l2) (reverse l) (length l) (list-ref l i)
(map f l) (for-each f l) (apply f args) (memq x l) (assoc k al) (list-copy l)
;; SRFI-1: (filter p l) (fold f init l) (reduce f d l) (iota n) (take l n) (drop l n) (delete x l)

;; ===== Data types =====
(vector 1 2) (vector-ref v i) (vector-set! v i x) (make-vector n x) (vector-map f v)
(string-append a b) (substring s i j
…

Appendix D: Scheme for Other Developers

Python / JavaScript Define a function def f(x): / function f(x) (defun f (x)...) (defn f [x]...) (define (f x)...) lambda x: / x => (lambda (x)...) (fn [x]...) Call a function value (funcall f x) (f x) (Lisp-1) False / empty list False / [] false, nil / ()

#f / '() (distinct; only #f is false) for, while loop, dolist loop/recur, doseq named let, do, tail recursion handler-case, restarts guard, raise call/cc, streams syntax-rules (hygienic) packages + ASDF define-library / import Key gotchas:

Only #f is false: 0, "", and '() are all true.

Argument evaluation order is unspecified.

'(...) literals are immutable.

/ on integers produces exact rationals: (/ 1 2) is 1/2, not 0.5.

R7RS is case-sensitive; R5RS wasn't.

Library and module syntax differs across implementations: check your implementation's documentation.

Appendix E: Resources and Study Plan

Standards and References R7RS-small (r7rs.org; the report is ~90 pages and very readable), R6RS, R5RS, and the SRFI site (srfi.schemers.org)

Implementation manuals: Chez Scheme User's Guide (CSUG) and *The Scheme Programming Language* (TSPL, Dybvig, free online), the GNU Guile Reference Manual, CHICKEN docs and eggs index, the Chibi manual, Racket docs

schemers.org, Scheme Wiki, and community lists such as "Awesome Scheme"

*Structure and Interpretation of Computer Programs* (SICP), Abelson & Sussman: free online; MIT 6.001 video lectures

*The Little Schemer*, *The Seasoned Schemer*, *The Reasoned Schemer* (Friedman et al.)

*The Scheme Programming Language* (R. Kent Dybvig): free online

*How to Design Programs* (HtDP): free online, Racket teaching languages

*Teach Yourself Scheme in Fixnum Days* (Dorai Sitaram): free online

*Simply Scheme* (Harvey & Wright): beginner-friendly *Essentials of Programming Languages* (Friedman & Wand): interpreters

*Lisp in Small Pieces* (Queinnec): implementation *Software Design for Flexibility* (Hanson & Sussman): advanced Scheme design

*Concrete Abstractions* (Hailperin, Kaiser, Knight) r/scheme, the #scheme channel on Libera.Chat, Guile and Guix mailing lists and IRC, CHICKEN mailing lists, Racket Discourse, the Scheme Workshop (annual, with ICFP), the European Lisp Symposium 12-Week Study Plan

Implementations, REPL, expressions, numbers, strings and symbols

Procedures, conditionals and equivalence, local bindings Lists, recursion and tail recursion, higher-order procedures

SRFI-1, vectors and hash tables, iteration, quasiquote SICP abstraction: procedures, data, records, trees

Symbolic data, generic operations, state, objects via closures

Multiple values, continuations, continuation patterns, dynamic-wind Exceptions, parameters, lazy streams

Macros: syntax-rules, advanced techniques, syntax-case, other systems

Libraries, I/O, eval, strings, pattern matching, SRFIs Metacircular, lazy, and amb evaluators; miniKanren; compilation 45–52 + Capstone

Implementations, objects, concurrency, FFI, tooling, performance, real-world use

Final tip: Scheme is small enough to hold in your head and deep enough to last a lifetime. Work through SICP and *The Little Schemer*, write your own evaluator, and experiment with continuations and macros until they feel natural. Then pick an implementation (Chez for speed, Guile for scripting and Guix, CHICKEN for its eggs, Racket for its ecosystem) and build something real. Happy Scheming! (λ)