You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to figure out part of the explanation that follows the listing for a while , but can't manage to make good sense of it.
This specific second part of the passage that follow the listing.
And if map2 evaluates its arguments in parallel (using whatever resource is being used to implement the parallelism, like a thread pool), that implies the left half of our computation will start executing before we even begin constructing the right half of our computation.
That second part (above) follows the following first part of the passage.
In this trace, to evaluate sum(x), we substitute x into the definition of sum, as we’ve done in previous chapters. Because map2 is strict, and Scala evaluates arguments left to right, whenever we encounter map2(sum(x),sum(y))(_ + _), we have to then evaluate sum(x) and so on recursively. This has the rather unfortunate consequence that we’ll strictly construct the entire left half of the tree of summations first before moving on to (strictly) constructing the right half. Here sum(IndexedSeq(1,2)) gets fully expanded before we consider sum(IndexedSeq(3,4)).
1) I wonder what is meant here, and if the language can be changed in the book to reflect that (in the second part of the passage)
It seems there is a mix of semantic which in my humble opinion may cause some folks (like me) to confused.
The all time, the passage at first talk about evaluation of arguments, in the context of scala strict evaluation mechanism. Then we have
And if map2 evaluates its arguments in parallel
Clearly the opposite of strict is not parallel, we are talking of strict vs lazy. So the parallel evaluation here is not about the same thing as first part the passage.
This mix of semantic does little help to understand the all passage in my humble opinion.
It feels to me that at that point we are talking about what is happening in the body of the function, as opposed to what is happening mechanically with scala strict evaluation.
Eitherway i do really not understand this statement
that implies the left half of our computation will start executing before we even begin constructing the right half of our computation.
Why ? what does it has to do with "the parallel evaluation". Parallel as opposed to what ? Synchronous ? sequential ?
Can someone manage to explain or showcase in whatever way the two scenarios and their difference ?
If map2 was "evaluating" its argument sequentially/synchronously what would be the difference ?
The text was updated successfully, but these errors were encountered:
If the authors indeed means, and if Map2 run its two Par arguments, asynchronously as opposed to synchronously, or in parallel as opposed to sequentially, then it should be made clear what happens in the opposing case i.e sequential/synchronously. If it does not make any difference, then stating it, is just confusing.
If my understanding is correct, then i don't think it make any difference wether the two Par are ran in parallel or sequentially, the outcome would be the same,
The left half of our computation will start executing before we even begin constructing the right half of our computation.
I'm trying to figure out part of the explanation that follows the listing for a while , but can't manage to make good sense of it.
This specific second part of the passage that follow the listing.
That second part (above) follows the following first part of the passage.
1) I wonder what is meant here, and if the language can be changed in the book to reflect that (in the second part of the passage)
It seems there is a mix of semantic which in my humble opinion may cause some folks (like me) to confused.
The all time, the passage at first talk about evaluation of arguments, in the context of scala strict evaluation mechanism. Then we have
It feels to me that at that point we are talking about what is happening in the body of the function, as opposed to what is happening mechanically with scala strict evaluation.
Eitherway i do really not understand this statement
Why ? what does it has to do with "the parallel evaluation". Parallel as opposed to what ? Synchronous ? sequential ?
Can someone manage to explain or showcase in whatever way the two scenarios and their difference ?
If map2 was "evaluating" its argument sequentially/synchronously what would be the difference ?
The text was updated successfully, but these errors were encountered: