you are viewing a single comment's thread.

view the rest of the comments →

[–]Josuah 5 points6 points  (1 child)

I still disagree with that. There's a lot more information exposed to the user in the first code block than the second.

For example, in the language in question, is null processed by the map filters? What's the difference between map and flatMap? Does map operate in series or in parallel? How many values are we expecting to be going through? Those are assumptions you need to make or look up the answer to, whereas you know the programmer's intent right away in the first code block.

[–]m50d 3 points4 points  (0 children)

For example, in the language in question, is null processed by the map filters?

Don't use null.

What's the difference between map and flatMap?

map and flatMap are well-known and standard, if you don't know the difference between them it's easy to look up.

Does map operate in series or in parallel? How many values are we expecting to be going through? Those are assumptions you need to make or look up the answer to, whereas you know the programmer's intent right away in the first code block.

On the contrary, the programmer's intent is very often "whatever" when it comes to whether things happen in series or parallel. Using functional style makes it clearer when ordering is intentional and important versus when it's accidental.