]> git.rkrishnan.org Git - sicp.git/blob - src/sicp/ex2_12.clj
Solution to 4.33. This had been difficult to get right, though conceptually it was
[sicp.git] / src / sicp / ex2_12.clj
1 (ns sicp.ex2_12
2   (:use [sicp utils ch2_1_extended ex2_7]
3         [clojure.test]))
4
5 (defn make-center-percent [c p]
6   (let [w (* c p 0.01)]
7     (make-center-width c w)))
8
9 (defn percentage [i]
10   (let [c (center i)
11         l (lower-bound i)
12         u (upper-bound i)]
13     (* (/ (- u c) c) 100)))