News for hackers. Stuff that matters.
Re:What if you couldn’t program with loops? by BalinKing on Monday July 15, 2019 @01:48AM (#20438463)
This seems a bit worrying to me as a general principle, since Javascript's lack of tail call optimization (TCO) means that you can blow the stack pretty easily by manually recursing. Just my two cents :-)
Re:What if you couldn’t program with loops? by BalinKing on Monday July 15, 2019 @01:49AM (#20438466)
(Out of curiosity, have you considered starting at raw recursion – like in your example – but then moving on to using utility functions like `map` from e.g. Ramda or lodash?)
Re:What if you couldn’t program with loops? by yjhoney on Monday July 15, 2019 @02:11AM (#20438544)
Yes. curriculum starts off with recursion, then moves on to higher order functions and nobody touches recursion again.
Re:What if you couldn’t program with loops? by yjhoney on Monday July 15, 2019 @02:10AM (#20438540)
eventually everyone defaults to using forEach, every, map, reduce, filter, etc. Nobody writes recursion in codebases.