This book is devoted to recursion in programming, the technique by which the solution to a problem is expressed partly in terms of the solution to a simpler version of the same problem. Ultimately the solution to the simplest version must be given explicitly. In functional programming, recursion has received its full due since it is quite often the only repetitive construct. However, the programming language used here is Pascal and the examples have been chosen accordingly. It makes an interesting contrast with the use of recursion in functional and logic programming. The early chapters consider simple linear recursion using examples such as finding the highest common factor of a pair of numbers, and processing linked lists. Subsequent chapters move up through binary recursion, with examples which include the Towers of Hanoi problem and symbolic differentiation, to general recursion. The book contains well over 100 examples.
I did not expect to enjoy Recursion via Pascal by J.S. Rohl this much. The text is concise and the code implementations are succinct (I’m looking at you, Introduction to Recursive Programming). The content strikes a fine balance between theory, analysis, and implementation.
Reading this book made me fall in love with Pascal again. I see now how Pascal influenced Go. The way code is written is beautiful and elegant. Fifteen years ago, I did not appreciate such beauty. But after a decade working with other languages, I am fond of it again. In fact, this book makes me want to give Nim another try. I see Nim as a lovely child of Python and Pascal.
One aspect I particularly enjoyed: the classic method of analyzing complexity by counting each instruction’s cost. This approach reveals performance subtleties that asymptotic analysis glosses over.
The last chapter on eliminating recursion is a treat. Not many textbooks, as far as I have read, touch the subject this deeply.
Verdict: Highly recommended. 4.5/5. It is classic, it is fun, and it will improve your problem-solving skills.