I recently read in this article to explain how JavaScript's ability to manipulate functions can be used so that every computer in the world can do a small part of processing all the information on the Internet. I understand that this is:
function map(fn, a) { for (i = 0; i < a.length; i++) { a[i] = fn(a[i]); } }
map function allows you to quickly call a function for each element of the array
map( function(x){return x*2;}, a );
and JS allows you to call a function without declaring it. The premise is that if all the data on the Internet was saved as an array, you can (somehow using map ) share the task of making certain changes to each element of the array between several processors or all computers in the world.
This is the part that I do not understand - why do you need to manipulate the t21 or JS array? Could you just send each computer a section of the array, send them a function to run on each element of the array and force them to convert the array without having to execute map or any number of wacky uses of the function?
Of course, using a function as an object seems convenient, but why is it generally inseparable from the task of separating tasks between the CPUs?
source share