I’m curious what will the OP is going to respond. I agree with you of course. I’m not a functional programmer, but as my experience tells me, if you design correctly then you will be able to parallelize automatically whatever can be parallelized. As is with the case the OP presented. Let’s look at it like this:
Since everything is immutable, it would be very easy to the compiler to determine the following:
- lines 1,2,5,6 can all be done in parallel.
- Line 2 execution can be immediately (without waiting for other tasks) followed by line 3.
- Line 4 can be executed right after lines 1 and 3
- And finally, the
instatement can be executed
Of course this is a rather simple case, but assuming everything has easily understood dependencies (and in functional programming, if I understand correctly, that would be only the parameters), it easy for a computer to parallelize.
Does that make sense?