summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2017-05-06 02:33:01 +0000
committerrsiddharth <s@ricketyspace.net>2017-05-06 02:33:01 +0000
commit32107633ace5bd487da78a1dde6e5ecc551b1321 (patch)
tree557e4ce52e4d6f116ea43837d57f256fc53a65e6
parent23011b4d055416fd536b519f8d3d8c48defb0f86 (diff)
sicp.org: Scribble ex. 1.20.
-rw-r--r--sicp.org36
1 files changed, 36 insertions, 0 deletions
diff --git a/sicp.org b/sicp.org
index 1b0a589..2b4bfc4 100644
--- a/sicp.org
+++ b/sicp.org
@@ -301,3 +301,39 @@ one/eleven.scm.
1 13 78 286 715 1287 1716 1716 1287 715 286 78 13 1
1 14 91 364 1001 2002 3003 3432 3003 2002 1001 364 91 14 1
#+END_SRC
+*** 20
+
+#+BEGIN_EXAMPLE
+normal order - no. of calls to remainder - inf
+applicative order - no. of calls to remainder - 4
+#+END_EXAMPLE
+
+#+BEGIN_EXAMPLE
+normal order
+(gcd 206 40)
+(gcd 40 (remainder 206 40))
+(gcd (remainder 206 40) (remainder 40 (remainder 206 40)))
+(gcd (remainder 40 (remainder 206 40))
+ (remainder (remainder 206 40)
+ (remainder 40
+ (remainder 206 40))))
+(gcd (remainder (remainder 206 40) (remainder 40 (remainder 206 40)))
+ (remainder (remainder 40 (remainder 206 40))
+ (remainder (remainder 206 40)
+ (remainder 40 (remainder 206 40)))))
+...
+#+END_EXAMPLE
+
+#+BEGIN_EXAMPLE
+applicative order
+(gcd 206 40)
+(gcd 40 (remainder 206 40))
+(gcd 40 6)
+(gcd 6 (remainder 40 6))
+(gcd 6 4)
+(gcd 4 (remainder 6 4))
+(gcd 4 2)
+(gcd 2 (remainder 4 2))
+(gcd 2 0)
+2
+#+END_EXAMPLE