4 ms·
Here you are defining a new function, not composing two functions. But if you consider a program implementation of pure functions, this might not be true; for
by woolion 3y ago
Here you are defining a new function, not composing two functions.
But if you consider a program implementation of pure functions, this might not be true; for example f and g use a quantity of RAM, but the RAM used by f o g exceeds your computer RAM and thus explodes.
Or, if we work with objects, some values (e.g. internal values of the object, or context values) may be changed that make the final result of f o g different from what you would normally expect.
The promise of working "functionally" is to avoid the second class of problems. For the first class this is just a problem of computer systems, but pure functions means that the memory should be able to be reclaimed efficiently. And for the limits of computability theory (like the halting problem), nothing works except oracle machines, but no startup has ever delivered a functional one!
- sterlind 3y agoComposing pure functions is equivalent to defining a new function, that's the idea behind the set of combinators being Turing-complete.