recursion - What's the explanation for Exercise 1.6 in SICP? -


I'm just starting to work through SICP (on my own, this is not for a class), And I was struggling with exercise 1.6 for some days and I do not know it. This is where Elisa redefines if in the context of cond , then it is like this:

  (define -Cong-clause) (code (again word-clause) (otherwise-clause))  

He tests on some simple cases, and then use it to re-write it Does the square root program (which was worked fine with if ):

  (define (sqrt-iter guess x) (new-if ( Good A-enough? Estimate x) (sqrt-iter (estimated estimate x) x))) The question asks: "What happens when the elisa calculates the roots of this square Trying to use it? " , I'm happy to reproduce other processes ( good-enough? ,  improve , etc.), just let me know.] 

Now, I know what happens: it never gives value, which means that the program is infinitely recursive. I can not tell why this happens why. If there is a difference between new and new-if then I can not find any more and all help in much appreciative.

New-if is a function when a function is called What is the first thing with the list of logic? It evaluates the all arguments.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -