3 ms·
It seems to me function composition does similar thing as inheritance. I don't know about other (more higher?) functionnal patterns. Side note: I already had t
by amirouche 11y ago
It seems to me function composition does similar thing as inheritance. I don't know about other (more higher?) functionnal patterns.
Side note: I already had to write or copy/paste most of the function of pytoolz already once at least.
- boothead 11y agoNot really - but it does let you chunk functionality together from smaller pieces. So if you have function f1 that takes a and returns b (a -> b) and a function f2 that takes b and returns c (b -> c) you can compose them into a function (a -> c) all it does is call f2(f1(a))
- agumonkey 11y agoInheritance is quite heavy and static. FP idioms are full of tiny combinators to assemble pieces of logic to suit your needs, flip/reorder parameters, "cache" them through partial application. The historical reusable code that OOP claimed through the 90s seems much more real using FP. OOP is too verbose and too name-friendly, people create lots of classes not abstract enough to be used anywhere else, closer to concrete types than abstractions.