4 ms·
> Functional programming is about function composition It sounds unnecessarily abstract. Isn't functional programming simply avoiding side effects? It forces y
by yodsanklai 7y ago
> Functional programming is about function composition
It sounds unnecessarily abstract. Isn't functional programming simply avoiding side effects? It forces you to use immutable datatype and write "pure" functions.
- crimsonalucard 7y agoI believe that function composition is the heart of the matter. Side effects and immutability are just the consequences of trying to create a primitive that can be used under function composition. In another post I illustrate exactly why I believe that it IS NOT necessarily abstract and in fact fundamental to FP: https://news.ycombinator.com/item?id=22292105 https://news.ycombinator.com/item?id=22292105
- yodsanklai 7y ago> Side effects and immutability are just the consequences of trying to create a primitive that can be used under function composition I think I see what you mean, but it sounds like you see function composition as the end, where I see it as a mean. To me, being side-effect free is the end because it helps me doing local reasoning which ultimately makes programs easier to reason about. That being said, I understand it may be easier to characterize formally FP using function composition.