|
|
|
|
|
by reitanqild
3430 days ago
|
|
Let me be the one: I'm a fairly decent programmer and I never worked with map or flatmaps outside of examples. I have however significantly simplified two significant code bases, made and maintained for years a webapp that users loved etc. Very often I feel it is just people wanting to sell something and it wouldn't surprise me if many of the people who sell functional are the same who sold object oriented back in the day. This article was actually a bit refreshing IMO. |
|
That being said, I love map/filter/flatMap. Look at them as higher level loops.
For example: A while loop is very general, you can implement any kind of loop with it. This makes it harder to understand the meaning of the loop. Therefore, when you want to iterate a constant number of times, you'll likely use a for loop. It expresses your intent better. Map, filter, and flatMap are just extending this principle to more specialised use cases. The advantage for a reader is that the one word "map" already tells them a lot about what the loop body is good for.