List comprehensions: Difference between revisions

m
(→‎JS ES6: Deleted redundant line, added code tags to preamble, bound 'pure' to x => [x])
Line 1,011:
// concatMap :: (a -> [b]) -> [a] -> [b]
const concatMap = (f, xs) => [].concat.apply([], xs.map(f));
// pure :: a -> [a]
const pure = x => [x];
// enumFromTo :: Int -> Int -> [Int]
const enumFromTo = (m, n) =>
Line 1,017 ⟶ 1,020:
length: Math.floor(n - m) + 1
}, (_, i) => m + i);
// pure :: a -> [a]
const pure = x => [x];
9,659

edits