sicp-ex-4.24



<< Previous exercise (4.23) | Index | Next exercise (4.25) >>


felix021

Below are 2 simple tests, loops and calculating fibonacci numbers.

 ; 4-24.test1.scm 
  
 (define (loop n) 
     (if (> n 0) 
         (loop (- n 1)))) 
  
 (loop 1000000) 
 (exit) 
 ; 4-24.test2.scm 
  
 (define (fib n) 
     (if (<= n 2) 
         1 
         (+ (fib (- n 1)) (fib (- n 2))))) 
  
 (fib 30) 
 (exit) 

My results are:

only eval: loop 9.689s, fib 18.880s

analyze + eval: loop 5.528s, fib 10.682s