Guy Arad
1 min readOct 9, 2016

--

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:

(I’ve never programmed Elm in my life, so excuse syntax error)

Since everything is immutable, it would be very easy to the compiler to determine the following:

  1. lines 1,2,5,6 can all be done in parallel.
  2. Line 2 execution can be immediately (without waiting for other tasks) followed by line 3.
  3. Line 4 can be executed right after lines 1 and 3
  4. And finally, the in statement 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?

--

--