Re:What if you couldn’t program with loops?
by deaddodo on Monday July 15, 2019 @04:44PM
(#20445056)
forEach is a loop, so this doesn't answer the basic question OP presented.
[ Parent
| on HN ]
Re:What if you couldn’t program with loops?
by dan-robertson on Monday July 15, 2019 @07:23PM
(#20446207)
The standard doesn’t specify whether or not forEach is a “loop” or not. One could implement it using tail recursion. FWIW I would claim that such recursion should also be called a loop, because the control flow goes in a loop.
Re:What if you couldn’t program with loops?
by deaddodo on Tuesday July 16, 2019 @12:48AM
(#20447545)
You're splitting hairs. I think we can both agree that no implementation does it as such. And if you're going to go to that low of a level, there's no such thing as a loop beyond emergent behavior (they're all conditional branches/jumps).