You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
233 B
JavaScript
12 lines
233 B
JavaScript
3 years ago
|
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()
|