;; ;; feet->meter consumes a number and produces a number ;; ;; (feet->meter nfeet) produces the number of meters corresponding ;; to nfeet feet. The function uses the conversion: ;; ;; meters = feet * 0.3048 ;; ;; example usage: (feet->meter 12.5) ;; (define (feet->meter nfeet) (* nfeet 0.3048)) ;; tests for feet->meter ;; (feet->meter 1) ; should produce 0.3048 ;; (feet->meter 1000) ; should produce 304.8 ;; (feet->meter 3280.8) ; should produce 999.98784 ;; ============================================================= ;; ;; meter->feet consumes a number and produces a number ;; ;; (meter->feet nmeter) produces the number of feet corresponding ;; to nmeter meters. The function uses the conversion: ;; ;; feet = meters / 0.3048 ;; ;; example usage: (meter->feet 12.5) ;; (define (meter->feet nmeter) (/ nmeter 0.3048)) ;; meter->feet tests ;; (meter->feet 304.8) ; should produce 1000 ;; (meter->feet 10) ; should produce 32.80839... ;; (meter->feet 0) ; should produce 0 ;; =================================================== ;; ;; check consumes a number and produces a boolean ;; ;; (check ft) converts the feet ft to meters using feet->meter ;; and then converts back again to feet using meter->feet. ;; The function returns true is the result of the two conversions ;; is equal to the original number, this is used to test both ;; functions (to make sure they work together properly). (define (check ft) (= ft (meter->feet (feet->meter ft)))) ;; (check 100) ; should produce true ;; (check 200) ; should produce true