<title>SICP Exercises (1)</title> SICP exercises (1) Table of Contents
- 1.1.1 Evaluation
- 2.1.2 Prefix form Conversion
- 3.1.3 To find the sum of the larger two numbers
- 4.1.4 Description Behavior
- 5.1.5 Applicative order vs Normal Order
11.1 Evaluation21.2 Prefix form Conversion
(/(+ 5 4 (-2 (-3 (+ 6 (/4 5)))) 3 (-6 2) (-2 7))
My practice is to start from the inside out.
31.3 The sum of the larger two numbers
(define (f x y z) (Cond ((and (<= x y) (<= x z)) (+ y z )) ((and (<= y x) (<= y Z)) (+ x Z )) (Else (+ x y))))
Note that you must add the = number, otherwise when x=y=3, Z=6 will execute X+y
41.4 Description Behavior
When B is greater than 0 get--that is a-a or otherwise a+b
51.5 applicative order vs Normal Order
Applicative Order: (Test 0 (p)) (test 0 (p)) has been indefinitely looped down
Normal order: (Test 0 (P)) (if (= 0 0) 0 (p)) because 0 equals 0, it does not execute (p)
Author:lexnewgate
created:2016-01-02 Saturday 01:58
Emacs 24.5.1 (ORG mode 8.2.10)
Validate
SICP Exercises (1)