summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2019-07-20 12:18:50 -0400
committerrsiddharth <s@ricketyspace.net>2019-07-20 12:18:50 -0400
commit533743ec841f9f8f0d56f1e345e1ceac6406f56a (patch)
treeba1ce7e4b92e76fab7700c9e733c4e906235f285
parentd3e3134b15f55329760ac92e09d08738ab97cfbf (diff)
sicp.org: Add excercise 29.d
-rw-r--r--sicp.org30
1 files changed, 30 insertions, 0 deletions
diff --git a/sicp.org b/sicp.org
index 0b9c03d..dbc13da 100644
--- a/sicp.org
+++ b/sicp.org
@@ -544,3 +544,33 @@ creates a list with the squared numbers in a messy nested list like:
(list x y)
'((1 2 3) (4 5 6))
#+END_SRC
+*** 29
+**** d
+Everything needs to be changed!
+
+Initially, for =make-mobile=, it used be:
+
+#+BEGIN_SRC scheme
+scheme@(guile-user)> (make-mobile (make-branch 5 50) (make-branch 5 50))
+$37 = ((5 50) (5 50))
+#+END_SRC
+
+Now (using =cons= instead of =list=) it is:
+#+BEGIN_SRC scheme
+scheme@(guile-user)> (make-mobile (make-branch 5 50) (make-branch 5 50))
+$58 = ((5 . 50) 5 . 50)
+#+END_SRC
+
+Initially, for =make-branch=, it used be:
+
+#+BEGIN_SRC scheme
+scheme@(guile-user)> (make-branch 5 (make-mobile (make-branch 3 50) (make-branch 3 50)))
+$61 = (5 ((3 50) (3 50)))
+#+END_SRC
+
+Now (using =cons= instead of =list=) it is:
+
+#+BEGIN_SRC scheme
+scheme@(guile-user)> (make-branch 5 (make-mobile (make-branch 3 50) (make-branch 3 50)))
+$60 = (5 (3 . 50) 3 . 50)
+#+END_SRC