Cartesian product of two or more lists: Difference between revisions
Content deleted Content added
→Functional JS: Updated n-ary version. |
→Functional JS: n-Ary version - a simpler and more maintainable foldr (using reduceRight) |
||
Line 1,170:
bind(as)(
x => bind(xs)(
a => [
[a].concat(x)
)
)
)([
// TEST -------------------------------------------
Line 1,204 ⟶ 1,208:
// foldr :: (a -> b -> b) -> b -> [a] -> b
const foldr = f => a => xs =>
▲ i = xs.length;
▲ return v;
▲ };
// intercalate :: String -> [a] -> String
|