Sep 6, 2018 · 1 min read
const strFloatToInt = compose(Math.round, parseFloat)
const trance = compose(
mapping(strFloatToInt),
filtering((x) => 20 < x)
);
[ '10', '11', '21', '20.4' ].reduce(
trance((acc, x) => acc.concat(x)),
[]
);As trance is interesting, mind explain why this version behaves like it’s using pipe?
I’ll do it then… as composedoes reverse mapping of the argument functions, chaining of the action reducers is from result collector ((acc, x) => acc.concat(x)) to filtering, filtering reducer to mapping and thus actor functions are called in reversed order per array item.