Functional-Light-JS
Functional-Light-JS copied to clipboard
ch4 composition: add not about composition being "associative"
compose(compose(fn3,fn2),fn1) ~=~ compose(fn3,compose(fn2,fn1))
As I know... Sets are types for programmer. If I write a function that given the same type of input(e.g. 1, 2, 3) and returns different type of output(e.g. 'a', 5, True), that will not be a set function which makes composition failed. Since composition is failed, it's no need to check if the composition being associative. If the function is just evaluate(mapping) from one type to another type(maybe the same). It will be a set function. Set functions's composition is always associative in category of set(Sets). If I'm wrong just let me know. Have a good day.