you can construct tree walks with iterators as well, they aren't as elegant, but fuck elegant simple and efficient matters more sometimes elegant isn't either of these
yeah, as a rule of thumb, if I can write a function in an iterative way, I do. But sometimes it's just not possible
i had one time i wrote an algorithm with recursion but it was for descending a configuration settings tree... it never got to more than a few levels of depth, and each level was an iterator itself graphs are very problematic in this respect... but i think a performant iterative walker could be written
One function I had to build iterative is about building the network graph on Nostr. You start with an npub, let's say fiatjaf, then you fetch all the people he follows. Calling this set N1. Then you fetch all people followed by N1 and you get N2. If you want to have a parameter `depth` that you can set, you have to use a recursive function. it was painful to debug, which is another problem with recursion