Dot product: Difference between revisions
Content deleted Content added
m →JS ES6: Tidied |
m →JS ES6 |
||
Line 1,590:
===ES6===
Composing functional primitives into a '''dotProduct()''' which returns a '''
<syntaxhighlight lang="javascript">(() => {
Line 1,597:
// ------------------- DOT PRODUCT -------------------
// dotProduct :: [Num] -> [Num] -> Either Null Num
const dotProduct = xs =>
ys => xs.length === ys.length
? sum(zipWith(mul)(xs)(ys))
:
|