If you have run the First Program, five lessons take you to your first decision rule. You start by reading parentheses, then give values names and choose a decision with a condition. In the last of the five, you write a rule that decides where a book's heading goes.
Run the examples in the Playground. Installation is optional. Knowing what a function call and a true-or-false question are is enough to begin. Lesson numbers match the menu numbers.
From parentheses to a first decision rule
| Lesson | What you build | Concepts | When you finish |
|---|---|---|---|
| 05. Reading the Parentheses | A nested width calculation | Call order, inner calls first, define | Why (+ 1 (* 2 (+ 3 4))) is 15 |
| 06. Values, Names, and Procedures | A reusable width procedure | define, let, lambda, argument count | One procedure for any trim width |
| 07. Code Is Data | A list that holds a decision | Quote, lists, car and cdr | keep taken out of the list |
| 08. Data, Conditions, and Decisions | A procedure that picks a decision | if, cond, and, or, only #f is false | A decision for each kind of heading |
| 09. First Decision Rule | A house style rule for headings | Two inputs, one decision, >=, input | Three cases and a JSON input rule |
More lessons
| Lesson | What you build | Concepts | When you finish |
|---|---|---|---|
| 10. Read and Handle Errors | A rule that handles wrong input | Diagnostic lines, guard, raise | A set decision for wrong input |
| 11. Recursion and Tail Calls | A procedure that sums a list | Named let, base case, tail calls | 10,000 tail calls at constant depth |
| 12. Closures That Remember Values | Two pairs of counters | Closures, cells, set! | Separate counts and a shared count |
| 13. Working with map, filter, fold, and apply | The sum of the squared odd numbers | filter, map, reduce, apply | List processing in one expression |
Study further with SICP
- SICP Study Guide runs a Scheme exercise file with the Lispex SICP profile on your computer and points you to the course at sicp.io.
Where to go next
- Run your rule from an application with Run Lispex in Your Application.
- Look up forms and procedures in Syntax at a Glance.
- Check a signed decision and run it again with Lispex Vouch.