parallel map and dot product

Norm Rubin nrubin at
Thu Apr 4 15:08:35 PDT 2013

>From a language point of view, I see the relation to array is pretty important but what about the approach in something like 

underscore.js:  _.sum(  ......)   
compared to:   Parallel.sum(

Where_ is some kind of object proving  map and friends
Then you could pass around special versions of map etc, like a version specially good for small parallel arrays, one for latency devices (cpus) , one for throughput devices (gpu)  or a version with extra debugging 

Is that far from the spirit of  JavaScript?

-----Original Message-----
From: Brendan Eich [mailto:brendan at] 
Sent: Thursday, April 04, 2013 4:34 PM
To: Hudson, Rick
Cc: Norm Rubin; es-discuss at
Subject: Re: parallel map and dot product

Hudson, Rick wrote:
> In this case it is the same as with a normal array.
> function dotProduct(v1, v2) {
> return (e, i) {return e*v2[i];}).reduce(function (a, 
> b) {return a+b;});
> }

So much nicer with ES6 arrow functions (now in SpiderMonkey):

function dotProduct(v1, v2) {
     return, i) => e * v2[i]).reduce((a, b) => a + b);


This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.

More information about the es-discuss mailing list