▲ | Spivak 5 days ago | ||||||||||||||||||||||||||||||||||||||||||||||
I'm in your camp, recursive code is hard for the next reader, which might be you, to understand. It's a bit too magic looking for my taste. If you're looping it should look like a loop, if you're pushing onto a stack you should get to see the stack. It's also safe against modifications which might silently break the tail-call nature of it until you blow out the stack later. It also gives you much saner and more debuggable stack traces because all the state is in the current frame. | |||||||||||||||||||||||||||||||||||||||||||||||
▲ | busterarm 5 days ago | parent [-] | ||||||||||||||||||||||||||||||||||||||||||||||
I never quite understood this recursion is hard/magic sentiment. Maybe it's because I started my CS education when it was still taught out of math departments or because it started with actually using programming languages to do algebra. Then again, the FP Kool-Aid is practically the blood in my veins at this point I guess. | |||||||||||||||||||||||||||||||||||||||||||||||
|