Learn how to use structural pattern matching (the match statement) to work recursively through tree-like structures.
You didn't ask, but let me tell you I learned a lot of maths over at KhanAcademy.