4 ms·
I also think it's a bit weird to flip direction of composition, but there are a couple of advantages -- 1. It keeps the "imperative" feel, so that you can writ
by crntaylor 13y ago
I also think it's a bit weird to flip direction of composition, but there are a couple of advantages --
1. It keeps the "imperative" feel, so that you can write
person.address.zipCode
rather than
zipCode.address.person
2. There's an argument that mathematical functions are "back to front" and that it would be more natural to write functions left to right, i.e. (x)f rather than f(x), so that the function composition f.g is "apply f then apply g" rather than "apply g then apply f" which is where we are at the moment.
- tel 13y agoLet's just go ahead and steal (<) and (>) for directional function composition everywhere. I'd rather just write `lt` and `gt`. x & f > g > h === h < g < f $ x
- tome 13y ago> There's an argument that mathematical functions are "back to front" and that it would be more natural to write functions left to right Totally agreed, but until programming languages adopt "x f = ..." for a definition of f then I'd prefer to stick to composing the traditional way round.