In applicative-order, factorial will enter an infinite loop, as
the exceptional-value is evaluated regardless the condition.
While in normal-order, the condition is judged before exceptional-value is evaluated.
4.26
It would fail if unless is passed as parameter, as there is no such
procedure.
4.27
(define w (id (id 10))) will cause the outer id being force, (id 10) is not evaluated and being returned as a thunk.
The evaluation of w forces the inner id being forced.
4.28
I think it would cause trouble if the operator is a thunk instead of actual procedure.
In order to make the operator be a thunk, the easiest way is to pass the procedure as a parameter.
such as:
4.29
To test the efficiency, simillar to the 4.24 problem.
4.30
display is a primitive function, so Ben is right.
with original version, (p1 1) = (1,2) and (p2 1) = 1 while in Cy’s version, both of them would be (1, 2).
(set! x (cons x '(2))) is passed in as a thunk parameter e of the internal p procedure in the
original version and is not forced as it is not passed to a primitive procedure.
Obviously.
I prefer the text’s. As lazy evalution is better not involved with side effects.