index.md (3628B)
1 --- 2 title: "The Little Schemer Will Expand/Blow Your Mind" 3 date: 2017-09-21T00:00:00+00:00 4 draft: false 5 canonical_url: https://www.viget.com/articles/the-little-schemer-will-expand-blow-your-mind/ 6 --- 7 8 I thought I'd take a break from the usual web dev content we post here 9 to tell you about my favorite technical book, *The Little Schemer*, by 10 Daniel P. Friedman and Matthias Felleisen: why you should read it, how 11 you should read it, and a couple tools to help you on your journey. 12 13 ## Why read *The Little Schemer* 14 15 **It teaches you recursion.** At its core, *TLS* is a book about 16 recursion \-- functions that call themselves with modified versions of 17 their inputs in order to obtain a result. If you're a working 18 developer, you've probably worked with recursive functions if you've 19 (for example) modified a deeply-nested JSON structure. *TLS* starts as a 20 gentle introduction to these concepts, but things quickly get out of 21 hand. 22 23 **It teaches you functional programming.** Again, if you program in a 24 language like Ruby or JavaScript, you write your fair share of anonymous 25 functions (or *lambdas* in the parlance of Scheme), but as you work 26 through the book, you'll use recursion to build lambdas that do some 27 pretty amazing things. 28 29 **It teaches you (a) Lisp.** 30 Scheme/[Racket](https://en.wikipedia.org/wiki/Racket_(programming_language)) 31 is a fun little language that's (in this author's humble opinion) more 32 approachable than Common Lisp or Clojure. It'll teach you things like 33 prefix notation and how to make sure your parentheses match up. If you 34 like it, one of those other languages is a great next step. 35 36 **It's different, and it's fun.** *TLS* is *computer science* as a 37 distinct discipline from "making computers do stuff." It'd be a cool 38 book even if we didn't have modern personal computers. It's halfway 39 between a programming book and a collection of logic puzzles. It's 40 mind-expanding in a way that your typical animal drawing tech book 41 can't approach. 42 43 ## How to read *The Little Schemer* 44 45 **Get a paper copy of the book.** You can find PDFs of the book pretty 46 easily, but do yourself a favor and pick up a dead-tree copy. Make 47 yourself a bookmark half as wide as the book, and use it to cover the 48 right side of each page as you work through the questions on the left. 49 50 **Actually write the code.** The book does a great job showing you how 51 to write increasingly complex functions, but if you want to get the most 52 out of it, write the functions yourself and then check your answers 53 against the book's. 54 55 **Run your code in the Racket REPL.** Put your functions into a file, 56 and then load them into the interactive Racket console so that you can 57 try them out with different inputs. I'll give you some tools to help 58 with this at the end. 59 60 **Skip the rote recursion explanations.** This book is a fantastic 61 introduction to recursion, but by the third or fourth in-depth 62 walkthrough of how a recursive function gets evaluated, you can probably 63 just skim. It's a little bit overkill. 64 65 ## And some tools to help you get started 66 67 Once you've obtained a copy of the book, grab Racket 68 (`brew install racket`) and 69 [rlwrap](https://github.com/hanslub42/rlwrap) (`brew install rlwrap`), 70 subbing `brew` for your platform's package manager. Then you can start 71 an interactive session with `rlwrap racket -i`, which is a much nicer 72 experience than calling `racket -i` on its own. In true indieweb 73 fashion, I've put together a simple GitHub repo called [Little Schemer 74 Workbook](https://github.com/dce/little-schemer-workbook) to help you 75 get started. 76 77 So check out *The Little Schemer.* Just watch out for those jelly 78 stains.