6 ms·
Function composition is associative but not commutative. So in essence given three functions z,g,f and composition operator <.> f . g . z != z . g . f (com
by leafboi 6y ago
Function composition is associative but not commutative.
So in essence given three functions z,g,f and composition operator <.>
f . g . z != z . g . f (commutativity)
which is sort of what fold left or right is doing (but with z g and f being the same function).
but:
f . g . z == z . (g . f) (associativity)
My edit is right about the operations not being commutative. Parent is wrong about associativity as it has nothing to do with this, but he is right that the codomains of left and right are not equal.
Function composition isn't completely accurate to what's going on, it's a more higher order form of composition going on with fold but the rules remain the same.
Whatever, either way, Overall I'm wrong
- roflc0ptic 6y agoBut sincerely, thanks for commenting. If I'm walking around self righteously asserting incorrect stuff I much appreciate people pointing it out
- jhanschoo 6y agoYou're right. > which is sort of what fold left or right is doing (but with z g and f being the same function). > it's a more higher order form of composition More precisely, a fold performs function composition on the provided operator curried with the respective elements, so that z g and f above are different functions (hence not commutative in general, but associative in general, wrt folding).