sicp exercises
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

754B

when attempting to compute square roots using the new new-if procedure (which acts as if however is not a special form), all three of the arguments to new-if must be fully evaluated before the new-if can return a value. this is in contrast to the special form if which only ever evaluates one of the second and third arguments, conditional on the first argument.

in this case, even if the current guess is good enough (indicating that the second argument of the new-if should be returned) the procedure is still required to evaluate the third argument, which contains a recursive call.

as such, using the non-special form new-if will never return a value, as it has no way of stopping evaluation once a good enough answer has been found.