3 ms·
I can see that making a call to a sub-function and returning from, it to the calling function means the state of the execution has changed. But it means the st
by galaxyLogic 3y ago
I can see that making a call to a sub-function and returning from, it to the calling function means the state of the execution has changed. But it means the state of the engine that evaluates the functions. As was said earlier the functions themselves do not have a state.
I don't think anybody would try to model a state-machine by making each state-change they want to model a call to a sub-function. The engine evaluating the function-expressions has its state but the functional program itself does not, it just has it code, arguments, and result. It can be in one of the states
1. Not Called
2. Calculating the result
3. The result has been calculated.
- Jtsummers 3y ago> It can be in one of the states > 1. Not Called 2. Calculating the result 3. The result has been calculated. That describes an oracle, not a purely functional program. A program describes a process (whether the program is purely functional or totally imperative). The state of the process can be captured in progress because, well, it's a process. There is a series of steps which are applied to produce the calculated result. In purely functional programs, that would be the reduction rules. Each application of a reduction rule produces a new state (in essence the remaining computation to be performed).