sicp-ex-1.2


  
 ;; ex 1.2 
  
 (/ (+ 5 
       4 
       (- 2 (- 3 (+ 6 (/ 4 5))))) 
    (* 3 
       (- 6 2) 
       (- 2 7))) 
  
 ;; Result is -0.24666666666666667, or -37/150 
  
  
 ;; ex 1.2 bis 
  
 (/ (+ 4 5 6 (/ 4 3) (- 2 3)) 
    (* 3 (- 6 2) (- 2 7))) 
  
 ;; The double substraction 2-(3-(6+4/3)) is simplified to 
 ;; 2-(3-6-4/3) which is then simplified to 
 ;; 2-3+6+4/3 which is better written as 
 ;; 2+6+4/3-3 
  
 ;; Result on my HP 71B is -255.555555555E-3 
 ;; (checked in Forth postfix syntax and Basic conventional syntax) 
  

<< Previous exercise (1.1) | sicp-solutions | Next exercise (1.3) >>