Re:Algorithms on Khan Academy – a collaboration with Dartmou...
by egonschiele on Monday November 17, 2014 @11:03PM
(#8622310)
Agreed! I snuck a small Haskell example into my book to show the advantages of pattern matching:)
Of course, it really helps to have algebraic types and pattern matching because they more clearly expose the recursive structure of both trees and tree-based algorithms. I've also found that writing things out in a patter-matching style, case by case, really helps convey how to think recursively. Instead of trying to run a recursive algorithm in my head, having the separate cases separate makes it easier to consider them one by one.