3 ms·
I think you misunderstood what the GP is saying. To take your example, given: fun f(a) = a + 3 fun g(b) = 2b Then: val x = f(2) val y = g(3) is equi
by denis1 11y ago
I think you misunderstood what the GP is saying. To take your example, given:
fun f(a) = a + 3
fun g(b) = 2b
Then:
val x = f(2)
val y = g(3)
is equivalent to
val y = g(3)
val x = f(2)
And this is true only because both f and g are pure functions.
- threatofrain 11y agoI don't see why your comment is not simply additive to mine. Both our statements are true, and are related to the general discussion. Your statement relates to the most "pleasingly parallel" situations. Mine refers to problem composability. This was the post right before the one we're talking about: >No, no it isn't. Just like you wouldn't expect 2 3 + 8 to suddenly return 22 when you intend it to, you shouldn't expect the order in which you apply functions to not matter.* A reasonable interpretation of the text and the one that follows is that some claims have been made that functional programming provides benefits of commutativity, and that people are disappointed to find no such benefit.