Sum of first n cubes: Difference between revisions

→‎{{header|JavaScript}}: Replaced a more general maximum with Math.max and a spread operator.
(Add Comal)
(→‎{{header|JavaScript}}: Replaced a more general maximum with Math.max and a spread operator.)
Line 1,225:
s.padStart(n, c)
) : "";
 
 
// maximum :: Ord a => [a] -> a
const maximum = xs => (
// The largest value in a non-empty list.
ys => 0 < ys.length ? (
ys.slice(1).reduce(
(a, y) => y > a ? (
y
) : a, ys[0]
)
) : undefined
)(xs);
 
 
Line 1,251 ⟶ 1,238:
const
colWidths = transpose(rows).map(
row => maximum(rowMath.mapmax(x => x.length))
y ...row.map(x => x.length)
ys.slice(1 ).reduce(
);
 
9,655

edits