4 ms·
Note that the parent said "if their inputs don't change". In general in this thread, some people are following the root comment in using "order in which functi
by dllthomas 11y ago
Note that the parent said "if their inputs don't change".
In general in this thread, some people are following the root comment in using "order in which functions are applied" to refer to what you mean - applying one function to the output of another, or vice-versa. Of course this affects the correctness of the result (and possibly also the well-typed-ness of the program).
Other people, like the author of your parent comment, are using "order in which functions are applied" to mean "order in which functions evaluated", which indeed does not for the correctness of pure functions (except possibly with respect to nontermination).
Working with f(x) = x + 3 and g(x) = 2 x, the expression f(g(7)) can be evaluated inside-out or outside-in:
f(g(7)) = f(2*7) = 2 * 7 + 3
f(g(7)) = g(7) + 3 = 2 * 7 + 3
As best I can tell, the confusion was introduced in this thread by coldtea's accusations against unspecified FP proponents.
Edited to add: per https://news.ycombinator.com/item?id=11396816 https://news.ycombinator.com/item?id=11396816, that should be "coldtea's incorrect accusations against now-specified FP proponents".