Re:Concatenation is composition
by tantalor on Monday July 18, 2022 @09:09AM
(#32137901)
The fact that you originally swapped /f/ and /g/ in your comment then edited it to fix there mistake is perfect example of why this is a dangerous and bug prone approach to writing programs.
[ Parent
| on HN ]
It's just f and g being poor names, also on keys next to each other. The circle is a good symbol for a whiteboard, but it's a poor identifier.
Normally you write composition like readFile().then(stripComments).then(sort).then(takeFirst), or compose using shell pipes.
Composition is so widespread and so trivial-looking that it's even easy to miss.