Question: HELP FOR RACKET LANGUAGE For Problem 4 of Homework 2, you wrote a candy-temperature function to implement a common conversion from The Joy of Cooking
HELP FOR RACKET LANGUAGE
For Problem 4 of Homework 2, you wrote a candy-temperature function to implement a common conversion from The Joy of Cooking. However, programmers who makes candy in the same city most of the time are forced to send theor city's elevation as an argument to the function every time. This is inconvenient. Write a Racket function named candy-temperature-at that takes one number as an argument: elevation (in feet) of a given location. candy-temperature-at returns a function that takes one argument, a temperature (in degrees Fahrenheit) to use for a candy. The returned function returns as its value the temperature to use for that candy at the specified elevation. For example:
> ((candy-temperature-at 5280) 302) 291.44 > (define temp-in-cf (candy-temperature-at 959)) > (temp-in-cf 240) ;; fudge! 238.082
(define candy-temperature-at (lambda (elevation) 'YOUR-CODE-HERE )) ; ----- tests ------- (define temp-in-cf (candy-temperature-at 959)) (check-= ((candy-temperature-at 5280) 302) 291.44 0.00001) (check-= (temp-in-cf 240) 238.082 0.00001)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
