What is Nostr?
Olav Fosse /
npub1x2c…q9hv
2024-02-12 14:58:31
in reply to nevent1q…ygut

Olav Fosse on Nostr: npub1zlnra…hu9mv I don't understand how it generates a recursive process. From my ...

npub1zlnra5g2uw7fk47qm5kt5uvvpy22pjrjgw7q30ghk2duau4yec7qhhu9mv (npub1zln…u9mv)

I don't understand how it generates a recursive process. From my understanding it is a recursive procedure generating an iterative process.

quote dump from http://sarabander.github.io/sicp/html/1_002e2.xhtml#g_t1_002e2

This type of process, characterized by a chain of deferred operations, is called a recursive process.

There's no chain of deferred operations, since the only invocation of f-iter- is the tail call:

(f-iter- (- m 1)
(+ a b)
(+ (* 2 a) c)
(* 3 a))

If there was an expression such as

(f-iter- (f-iter- 'foo))

that would generate a recursive process since during the execution of (f-iter- 'foo) there is a deferred operation (f-iter- (f-iter- 'foo))

In general, an iterative process is one whose state can be summarized by a fixed number of state variables, together with a fixed rule that describes how the state variables should be updated as the process moves from state to state and an (optional) end test that specifies conditions under which the process should terminate.

The contrast between the two processes can be seen in another way. In the iterative case, the program variables provide a complete description of the state of the process at any point. If we stopped the computation between steps, all we would need to do to resume the computation is to supply the interpreter with the values of the three program variables. Not so with the recursive process. In this case there is some additional “hidden” information, maintained by the interpreter and not contained in the program variables, which indicates “where the process is” in negotiating the chain of deferred operations.

I'd love to be proven wrong :)
Author Public Key
npub1x2cqsfzs6gnfluzz48922n23xazeumhsaukq02v934dk2dydwaustwq9hv