4 ms·
Composition is not about writing everything in one line.
by Argorak 12y ago
Composition is not about writing everything in one line.
- NateDad 12y agoYou'll have to explain to me what you mean by composition if you don't mean foo(bar(baz())) or foo().bar().baz() Composition means putting things together, if you're not doing it on one line, then what's wrong with a loop?
- Argorak 12y agoFor example, Iterators are composable. I can return one from a function, append another iterator to the chain, return that and then iterate over the whole result (possibly, this leads to only one iteration internally). I cannot return a loop.