summaryrefslogtreecommitdiffstats
path: root/sicp.org
diff options
context:
space:
mode:
authorrsiddharth <rsiddharth@ninthfloor.org>2016-03-12 11:37:03 -0500
committerrsiddharth <rsiddharth@ninthfloor.org>2016-03-12 11:37:03 -0500
commit94758d69d5ef1eccf39842fb806e736b31387fa6 (patch)
treea2a509c4b41089daed52c88a4112ddc4f3f45d03 /sicp.org
parent1375cccf75aee17bbe576a744583ed9e7f7d939e (diff)
Tried answering 1.1.6
Diffstat (limited to 'sicp.org')
-rw-r--r--sicp.org11
1 files changed, 11 insertions, 0 deletions
diff --git a/sicp.org b/sicp.org
index a349e51..0fa7a29 100644
--- a/sicp.org
+++ b/sicp.org
@@ -46,3 +46,14 @@ order*, the expression will be expanded to
#+END_SRC
and will evaluate to ~0~.
+*** 6
+ If I've understood it correctly, scheme uses applicative-order
+ evaluation, meaning, it evaluates the operands before appling the
+ procedure.
+
+ In the case when ~new-if~ used in the ~sqrt-iter~ procedure, the
+ operands/arguments for the ~new-if~ -- ~(good-enough? guess x)~,
+ ~guess~, ~(sqrt-iter (improve guess x) x)~ -- are evaluated. Due
+ to the last operand, which is a call to the ~sqrt-iter~ procedure,
+ we get into infinite loop of evaluating the ~sqrt-iter~ procedure
+ again and again.