Clojure – bmi calculation, metric and English

(defn bmi-metric [height weight] (/ weight (* height height)))
user=> (bmi-metric 1.8 90.0)
27.777777777777775

(defn bmi [height weight] (* 703.00 ( / weight (* height height))))
user=> (bmi 72 200)
27.12191358024692

formula via http://www.whathealth.com/bmi/formula.html

Leave a Reply

Your email address will not be published.