Middle three digits: Difference between revisions
Content deleted Content added
m →{{header|JavaScript}}: (simpler expression for max numeric string length) |
|||
Line 2,674:
-100, 100, -12345, 1, 2, -1, -10, 2002, -2002, 0
],
w =
return (
unlines(map(
Line 2,709 ⟶ 2,704:
// abs :: Num -> Num
const abs = Math.abs;
// comparing :: (a -> b) -> (a -> a -> Ordering)▼
const comparing = f =>▼
// drop :: Int -> [a] -> [a]
Line 2,737 ⟶ 2,723:
// even :: Int -> Bool
const even = n => 0 === n % 2;
1 < xs.length ? xs.slice(1)
// id :: a -> a
Line 2,757 ⟶ 2,748:
) : Infinity;
//
const
0 < xs.length ? (
▲ .reduce((a, x) => 0 < f(x, a) ? x : a, xs[0])
) : undefined;
|