List comprehensions: Difference between revisions

Content deleted Content added
Telephon (talk | contribs)
Hout (talk | contribs)
Line 995: Line 995:
by using concatMap / flatMap (the monadic bind function for lists), and x => [x] (monadic return for lists):
by using concatMap / flatMap (the monadic bind function for lists), and x => [x] (monadic return for lists):


<lang JavaScript> (function (n) {
<lang JavaScript> (n => {
'use strict';

let flatMap = (xs, f) => [].concat.apply([], xs.map(f)),
let flatMap = (xs, f) => [].concat.apply([], xs.map(f)),