by a3voices · 11y ago · 0 comments
Ever?
Those are trees. Want to walk the UI to find an element? Trees. Want to manipulate the DOM? Trees.
Walk a file system?
Write a file system?
Trees and trees.
Furthermore, part of our indexing needed to follow imports to find the canonical name of a value, which is a problem very well suited to a recursive solution.
You may not have encountered these situations where recursion and trees have to be dealt with, but they absolutely exist.
I'm all for code-reuse and componentization but common... recursion is programming 101!
I say this because I was originally a self-taught programmer, and I hated recursion too. Once I went to school for a CS degree, I learned how awesome it really was, and now I use it all the damn time.