Skip to content

Month: February 2013

Learn You Some Erlang for Great Good!

Functional programming is not new, but it is becoming popular once again. For this reason, in my last book review, I talked about a Lisp book and this review will cover a book on Erlang. Functional programming treats computation differently from other programming languages. Here, computation is done by evaluating mathematical functions. State and mutable data are avoided. Most of this is rooted in lambda calculus, in which everything is a function (yes, I’m simplifying, but this is a short review). Even if you prefer to use a different programming style, learning a functional language is beneficial to expand your skills and your ability to think of a problem in multiple ways, which often leads to more elegant and human-readable solutions. This is vital for long-term maintainability of code.

Learn You Some Erlang for Great Good! is by Fred Hébert. One of the things I really admire and appreciate about the author is that he provides a great example to others. So often, budding programmers and computer scientists feel intimidated by functional programming, somehow believing that they need to study for years and earn a higher level computer science degree before they even make the attempt. Hébert is a self-taught programmer and also the author of one of (perhaps the) most respected and used Erlang tutorials out there, on which this book is based and shares a title. He was named Erlang user of the year for 2012. Hébert proves that really bright people can learn and use and teach complicated things, and you can do so without learning it in a university. So, put aside the intimidation and press on!

This book covers all the basics of language and syntax, as well as the needed functional programming concepts and techniques. It covers the hot Erlang topics of today, too, stuff like concurrency and distributed computing. One thing I love is that as the book discusses these things, it does so without the typical hype and over-zealousness that often accompanies Erlang presentations and discussions. In fact, there is an amusing series of information box notes throughout the book, each titled “Don’t Drink Too Much Kool-Aid,” that give a welcome, balanced view of various features, praises, and criticisms of Erlang. Each of these shows a grounding in reality that comes from real-world use.

This is a serious book filled with quality discussions, clear writing, interesting and useful examples, and an occasional bit of whimsy. The book isn’t playful like Land of Lisp, but it isn’t dry and boring or overly academic, either. It is an accessible, practical book that the real-world programmer who is considering Erlang will find useful.

Disclosure: I was given my copy of this book by the publisher as a review copy.

Land of Lisp

Programming books are not fun. No one uses Lisp anymore, and almost no one ever did. There is no practical reason to read a book about Lisp. These are a few misconceptions that this review aims to correct.

Land of Lisp is by Conrad Barski, M.D. It is a book filled with enjoyable art, clear prose, and an easy to follow structure. The examples used in the book are easy to comprehend and do a very good job of illustrating the concepts being taught while also being interesting.

Let’s step back for a minute. What is Lisp? Lisp is a functional and expressive programming language. It was born out of an attempt to make a programming language that is easily read and understood by humans while also being able to do a lot in a short number of lines. Lisp code is compact and involves a manner of expressing instructions that is different from any other programming language I have experienced. It is with good reason that people describe Lisp as poetry, as elegance, or as “casting spells”. When you really get it, Lisp will affect how you program in any language because it changes how you think. I may be biased, I first encountered Lisp way back in 1987.

Land of Lisp includes within it the same sense of quirky brilliance that you remember in your favorite computer science or physics gurus. All share a different, not-completely-serious way of looking at the world that also allows them to come up with ideas that shatter stereotypes and enable new inventions. The book resides somewhere between the classic The Far Side comics and Richard Feynmann, perhaps with some of the better qualities of Richard Stallman thrown in, without Stallman’s sometimes off-putting traits. The book is a throwback to an era when playful brilliance was the norm in science, including computer science, and I mean that in a good way. This is one of the most fun computer books I have ever read.

So what about the quality of the information, from a technical standpoint? Rest easy, this also receives kudos. Land of Lisp starts with a short history section to give the reader context and then jumps right in to programming. Throughout the book, games are used to illustrate concepts. The first game is identical to the “guess the number” game I programmed on my Casio fx-7200G programmable graphing calculator back in 1986. The game is a simple one, but it provides a launching pad to greater things. The program is used to discuss global and local variables, functions, and basic Lisp etiquette.

From here, we move into syntax, code and data, and lists. Then, in the section titled “Lisp is Symmetry,” we begin the deeper topics like conditionals, paths, objects, reading and printing text, lists, and lambda. The last one, lambda, even gets its own chapter, which is a good thing since so many find it difficult and confusing at first. Before the section ends, Land of Lisp helps you learn important concepts using the classic Hunt the Wumpus and we get into arrays, hash tables, structures, and sequences. Now we are almost halfway through the book.

Land of Lisp includes some atypical examples for Lisp, and I like this. While it teaches the remaining vital programming concepts and Lisp style, we learn not only silly games, but even how to create a web server, really grok functional programming, macros, and more. The book is focused on Common Lisp, but modern variants like Clojure are also discussed.

If you have ever wanted to learn Lisp, but find typical tutorials and resources a bit dry, this is the book for you. Even if you aren’t as excited about the playful bits of the book, the quality of the prose and technical descriptions are such that you should give Land of Lisp a chance.

Disclosure: I was given my copy of this book by the publisher as a review copy.