Source code from the book Eloquent Ruby