▲ | zelphirkalt 5 days ago | ||||||||||||||||
I have my doubts about any CS class/lecture, that teaches, that the "iterative version is easier to scan". Might just be the bias or inexperience of the lecturer. By not I find recursive to be often easier to read than some for loop with its loop header and counter that I need to think about and update in my mind. And then the loop usually in many languages does not even have a return value, because it is not an expression, but a statement. Meeehhh, very meehhh in many languages. Not all, but many. I think maybe in languages like Ruby or Smalltalk a loop can be more readable, because of how they structure it as messages to objects, rather than special keywords in the language. | |||||||||||||||||
▲ | hinkley 5 days ago | parent [-] | ||||||||||||||||
> I have my doubts about any CS class/lecture, that teaches, that the "iterative version is easier to scan". Well then you’re in luck because that was not an academic statement but a professional opinion - mine. You can’t optimize the patterns you can’t see because they’re obscured by accidental complexity. And iteration is a frequent trick I use to surface deeper pattern s. | |||||||||||||||||
|