Exercise 2.2.1.
Define the programFahrenheit->Celsius
, which consumes a temperature measured in Fahrenheit and produces the Celsius equivalent. Use a chemistry or physics book to look up the conversion formula.
'Deduct 32, multiply by 5, divide by 9.' The code I came up with works but is unsatisfying - I wanted to cram everything into one expression but can't figure out how. Or if I can.
(define (fah-celd r)
(* 5( - r 32)))
(define (fah-celf r)
( / (fah-celd r) 9))
> (fah-celf 32)
0
> (fah-celf 40)
4.4
Anyone on my short list of internet friends speak LISPish?