exercise-31.scm (791B)
1 (define-library (sicp tests chapter-1 exercise-31) 2 (import (scheme base)) 3 (import (srfi :1)) 4 (import (srfi :64)) 5 (import (sicp solutions chapter-1 exercise-31)) 6 7 (begin 8 (define fac-10 9 (reduce * 10 1 11 (iota 10 1))) 12 13 (test-begin "chapter-1-exercise-31") 14 (test-equal 15 fac-10 16 (factorial 10)) 17 (test-equal 18 628 19 (floor (* 100 (tau-approximation 1000)))) 20 (test-equal 21 (iterative-product (lambda (x) (* x x)) 22 1 23 (lambda (x) (+ 2 x)) 24 10) 25 (recursive-product (lambda (x) (* x x)) 26 1 27 (lambda (x) (+ 2 x)) 28 10)) 29 (test-end "chapter-1-exercise-31")))