>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 

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


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:[email protected]] 
Sent: Thursday, April 04, 2013 4:34 PM
To: Hudson, Rick
Cc: Norm Rubin; [email protected]
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 v1.map(function (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 v1.map((e, i) => e * v2[i]).reduce((a, b) => a + b);

}


/be
-----------------------------------------------------------------------------------
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.
-----------------------------------------------------------------------------------
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to