r/backtickbot • u/backtickbot • Dec 08 '20
https://np.reddit.com/r/functionalprogramming/comments/k99t81/can_a_function_call_another_function/gf3b791/
Not a functional programmer, but read a lot about it. I'll be using Typescript.
A function that calls a parameter is as pure as the called parameter. For example, you have the following function call:
function call(f: () => int): int {
return f();
}
We might use the `call` function as a pure function or an impure function:
typescript
let x = call(() => 1); // call is pure
let y = call(() => {
x = 2;
return 1;
}); //call is impure
0
Upvotes