|
|
|
|
|
by renerick
422 days ago
|
|
Explaining loops is independent of the concepts of collections though. It's also more general, since map/filter/reduce use some kind of loops under the hood anyway, the fact that probably shouldn't be ignored in education process. Unless of course you go with pure functional recursive iterator, but good luck explaining that one. Maps and filters also require understanding of higher order functions and the very idea of passing function around as a value. I would argue that implementing map/filter with a loop and then demonstrating how this pattern is generalized as .map()/.filter() functions is better and more accessible |
|