Minimum numbers of three lists: Difference between revisions
→{{header|JavaScript}}
(→{{header|JavaScript}}: Added a JavaScript version.) |
|||
Line 207:
// --------------------- GENERIC ---------------------
// min :: Ord a => (a, a) -> a
const min = (a, b) =>
// The lesser of a and b.
// minimum :: Ord a => [a] -> a
Line 212 ⟶ 218:
// The least value of xs.
0 < xs.length ? (
xs.slice(1).reduce(min, xs[0])
▲ ) : a,
) : null;
Line 234 ⟶ 235:
// MAIN ---
return JSON.stringify(main());
})();</lang>
{{Out}}
|