Closed tshemsedinov closed 6 years ago
@tshemsedinov, one more option is:
const composedChain = compose(
filter(x => x > 0), arr => (arr[0] = 2, arr), map(x => ++x)
);
@DzyubSpirit this syntax require filter
, map
and other methods visible in global context.
@tshemsedinov, no, it can be used as that:
const M = module;
const composedChain = compose(
M.filter(x => x > 0), arr => (arr[0] = 2, arr), M.map(x => ++x)
);
That is harder, I agree. There is trade off between complexity of getting functions from module and ability to use custom functions (like second in example)
@DzyubSpirit I think to compose chain we can use following syntax:
And then use it:
It will be equivalent for expression/superposition:
But unknown
data
. We can also do it easier:But in case of simple
compose
we also can do as lambda:But function
compose
gives us flexibility and unification. So chain composition may give us something interesting. Need more examples, I think.