summaryrefslogtreecommitdiffstats
path: root/sicp.org
diff options
context:
space:
mode:
authorrsiddharth <rsiddharth@ninthfloor.org>2016-01-22 20:08:52 -0500
committerrsiddharth <rsiddharth@ninthfloor.org>2016-01-22 20:08:52 -0500
commit1375cccf75aee17bbe576a744583ed9e7f7d939e (patch)
tree320ba68afab0ded39c983c84c8d0e7307aacbfed /sicp.org
parent227f0b51ff0aff69586e16a3c9db190475cbfa84 (diff)
Added sicp.org
Diffstat (limited to 'sicp.org')
-rw-r--r--sicp.org48
1 files changed, 48 insertions, 0 deletions
diff --git a/sicp.org b/sicp.org
new file mode 100644
index 0000000..a349e51
--- /dev/null
+++ b/sicp.org
@@ -0,0 +1,48 @@
+* status
+ Excercise 1.1 - 1.5
+* notes
+** 1
+*** 1
+**** 5
+#+BEGIN_QUOTE
+In general, when modeling phenomena in science and engineering, we
+begin with simplified, incomplete models. As we examine things in
+greater detail, these simple models become inadequate and must be
+replaced by more refined models.
+#+END_QUOTE
+* exercises
+** 1
+*** 4
+
+ #+BEGIN_SRC scheme
+ (define (a-plus-abs-b a b)
+ ((if (> b 0) + -) a b))
+ #+END_SRC
+
+If ~b~ is greater than 0, do ~a + b~; otherwise do ~a - b~.
+*** 5
+
+code at [[./one/five.scm]]
+
+If the interpreter uses *applicative order* to evaluate the
+expression:
+
+#+BEGIN_SRC scheme
+(test 0 (p))
+#+END_SRC
+
+The parameters are evaluated before applying the compound procedure
+~test~; 0 evaluates to 0, ~(p)~ never finishes evaluating as the
+compound procedure ~p~ recursively calls itself again and again
+infinitely.
+
+If same expression is evaluated by the interpreter using *normal
+order*, the expression will be expanded to
+
+#+BEGIN_SRC scheme
+ (if (= 0 0)
+ 0
+ (p)))
+#+END_SRC
+
+and will evaluate to ~0~.