mirror of
https://github.com/ray-x/navigator.lua
synced 2024-11-15 18:12:50 +00:00
12 lines
233 B
JavaScript
12 lines
233 B
JavaScript
function curriedDot(vector1) {
|
|
return function(vector2) {
|
|
return vector1.reduce(
|
|
(sum, element, index) => (sum += element * vector2[index]),
|
|
0
|
|
);
|
|
};
|
|
}
|
|
|
|
const sumElements = curriedDot([1, 1, 1]);
|
|
console.log()
|