3 ms·
I think it's fair to assume that most of us have been schooled in imperative then later OO styles, with probably no attention (my case) or little attention give
by dhab 10y ago
I think it's fair to assume that most of us have been schooled in imperative then later OO styles, with probably no attention (my case) or little attention given to FP styles.
Having tried FP a little bit now, I think it's quite powerful (although not a silver bullet).
Given function: max x y = if x > y then x else y
foldr max (minBound::Int) [1,10,-11,1] // yields 10
foldr (max.(uncurry max)) (minBound::Int) [(1,-11), (10,1)] // yeilds 10
While not always the case, I think much of FP code demonstrates ease-of-compositionality (partial func, composition operator in second ex), ease-of-reuse (of max function in different contexts) in a vein similar as above. I think most of the time maintainability is a positive side-effect.
I wonder how many of commenters here have seriously tried all imperative/OO/Functional styles of programming, and still think FP is not something to invest anymore time/effort in vs the other paradigms.
Personally, I'd hope more energy was spent on eliminating the short-comings of FP, than keeping a firm foot in the OO camp, which I think is already overloaded with too much attention with quickly plateauing benefits in return (at language level, not in terms of products that come out of it)