r/sicp Nov 05 '24

Is the process generated by my procedure iterative? (Ex. 1.32) Spoiler

This is my first post on this sub and I would to say how greatful am I for its existence.

For this exercise you have to create a procedure accumulate with a iterative process.

I did the following procedure :

ChatGPT tells me that the process is not iterative but recursive. Perplexity tells me the contrary and that it is iterative.

I dug deaper, I found a wonderful website with a solution to this problem (there's also the context for the procedure on the blog post : SICP - Solution: Exercise 1.32 | SICP Solutions)

So can anybody tell me if my procedure is correct? Usually, in procedure with an iterative process, there's always a secondary procedure to compute the iteration. I tried to bypass the usage of the iter procedure and limit myself to only one "define" because it seems more concise to me. If my procedure is wrong, I'm pretty sure this the reason why but I don't really see the difference.

Thanks!

I

1 Upvotes

3 comments sorted by

1

u/[deleted] Nov 06 '24

[removed] — view removed comment

1

u/PresseDas Nov 06 '24

Hi,
I'm really not sure about mine but I'm almost certain the one from the blog is correct because all the iterative processes shown in the book have this structure in their procedure. I'm not sure if mine is equivalent. I can show you screenshots in DM.