The people at no starch press were kind enough to give us a review copy of Realm of Racket: Learn to Program, One Game at a Time! This is a coding book presented in coding style with plenty of recursion. It’s written as if the reader were a computer compiling and running the content. The style begins on the title page with the author listing in a list, complete with parenthesis and follows through with side notes scattered throughout the book in the style of Racket comment syntax.
Just like this one
…they even throw in a different font to nerd up the text just that little bit extra
There are eleven authors credited in Realm of Racket, which you would expect to result in a mishmash of styles and opinionated banter. The camel, as they say, is a horse designed by committee. Not so for this book, the style is consistent throughout, the humor is there too and tonnes of learning, great learning examples with clearly written, well commented code that my eleven year old son can follow. I was unable to pick the points where one author left off and another began. Of course the camel example is a good talking point, it is very well suited to its environment, so if it was designed by committee they did a good job (as evidenced by the fact that a camel is featured on the cover of the O’Reilly Perl book)
In the author Matthias Felleisen’s own words
“The author team really consists of eight students and two ‘old’ people: David Van Horn and myself. As is tradition in my lab, young people go first and ‘old’ people come last on an author list. Everyone knows us already anyway.”
Eight students and two ‘old’ people makes ten, so I guess Conrad Barski is credited because he wrote Land of Lisp: Learn to Program in Lisp, One Game at a Time! (Review), from which much of the inspiration is drawn. I’m impressed with the way the author listing is presented; the students in alphabetical order followed by the ‘rest’ of the list. It’s reminiscent of the story about Ron Rivest and Adi Shamir having gone through forty-two iterations of their encryption algorithm, only to have each defeated by their colleague Leonard Adleman. Finally they got to iteration number forty-three which he was unable to break, Rivest tried to list the paper’s authors alphabetically as Adleman, Rivest, Shamir, but Adleman objected with words to the effect of “it’s your work not mine” eventually compromising to have his name added at the end. Thus yielding RSA one of the best known encryption algorithms still around today…but I digress.
Realm of Racket is a succinct book, it does assume some previous knowledge of programming, but is still very accessible for a novice. ‘Written by freshmen for freshmen’, as they say. Each chapter presents a topic that is explained, coded, used and illustrated to drive home a thorough understanding. I like the way that all the code in the book is included with the latest release of Racket, and that not every line is explained verbatim. The onus is on the reader to participate through reading the accompanying code. This participation reenforces learning and the association with the content will enamor the reader with the book. There is plenty of encouragement to play with the code, even so far as suggesting things to try and questioning the reader as to why things are the way they are, or leaving it to the reader to prove to themselves that some example code works correctly.
As with the Land of Lisp the content is presented in the form of games. Games are written and coded up to demonstrate a programming concept. The concepts from earlier lessons are bundled like Lego bricks together to form a solid wall of knowledge. My son worked through the Snake game on his own and having transposed the x and y coordinates had to retrace his steps, but was able to debug and produce a working game. I have since then been tracing through the provided code with him, as a teaching exercise (for me just as much as for him!). He is well able to follow along, even picking up some mistakes I’ve made in reading the code. There are some mathematical concepts that he hasn’t yet come to (Calculus, Complex Numbers and Trigonometry) so we have had to gloss over some parts, but the learning aspect of Racket for both of us has been well worth the effort.
Racket is a functional language from the Lisp family, with all the great concepts that come from this family of languages. It has some syntactic sugar to sweeten the learning curve (‘first’ or ‘second’ instead of ‘car’ or ‘cadr’ etc) but it still packs the same punch as the other Lisp languages. The big bang graphics component is a sure-fire winner to gets my son’s attention and capture his imagination. If you are looking for one resource that will be your first introduction to functional programming then I would highly recommend Realm of Racket. If you are looking for a couple of resources then also take a look at Land of Lisp, Coursera’s Functional Programming course or SICP.