I recommend ML version of this book.
Functional programming is a much better suited paradigm for task like these.