Jon Aquino's Mental Garden

Engineering beautiful software jon aquino labs | personal blog

Thursday, January 03, 2008

Programming Book: The Little Schemer

I'm having fun going through a computer-programming book called The Little Schemer. It consists of dozens of exercises that you solve using little snippets of recursive code. It definitely has the feel of a game - Sudoku moreso than Call of Duty.

The key to enjoying this book is to not get hung up on the non-code questions. The book is written as a list of questions and answers, and it's frustrating to try to answer the non-code questions because they are often unguessable:

Q: Is that bad?
A: You must beware of shadows

Quickly read through the non-code questions and answers. But try to answer the code questions - that's the stuff that's fun and interesting.

Q: Write fun? with set? and firsts
A: (define fun? (lambda (rel) (set? (firsts rel))))

You'll find pencil and paper to be too slow for this stuff; a text editor is more convenient. But you need not bother running the code through a compiler - the answers are given on the same page.


Post a Comment

<< Home