CSC 533: Organization of Programming Languages
Fall 2002
HW5: Scheme Programming
For this assignment, you are to define the following Scheme functions. For
simplicity, place all of your function definitions in a single file named
hw5.scm. Be sure to comment each function as to its behavior.
 Define functions for converting temperatures from Fahrenheit to Celsius,
and vice versa. For example, (fahr>celsius 212) should evaluate to
100, while (celsius>fahr 0) should evaluate to 32. The formula for
converting from Fahrenheit to Celsius is:
tempInCelsius = (5/9) * (tempInFahrehneit  32)
 Define a function named windchill that takes two inputs, a
temperature (in degrees Fahrenheit) and a windspeed (in miles per hour), and
returns the corresponding windchill factor. The formula for computing the
wind chill is:
windchill =
 {
 temp
 if wind <= 3

35.74 + 0.6215*temp + (0.4275*temp  35.75)*
wind^{0.16}
 otherwise

For example, (windchill 38 2) should evaluate to 38 since a
windspeed of only 2 miles per hour has no effect on the temperature of
38 degrees Fahrenheit. Note: the return value for this
function should be inexact.
 Define a function named numoccur that takes two inputs, an atom
and a list, and returns a count of the number of times the atom appears in the
list. For example, (numoccur 'x '(z x e x)) should evaluate to 2.
 Define a function named remove that takes two inputs, an atom
and a list, and returns the list with each occurrence of the atom removed.
For example, (remove 'x '(z x e x)) should evaluate to (z
e).
 Define a function named subst that takes three inputs, two atoms
and a list, and returns the list with each occurrence of the second atom
replaced by the first. For example, (subst 'a 'x '(z x e x)) should
evaluate to (z a e a).
 Define a function named prime? that takes one input, a positive
integer, and returns #t if that number is prime, else #f.
For example, (prime? 6) should evaluate to #f, while
(prime? 7) should evaluate to #t. Your function should only
utilize tailrecursion (perhaps a help function will be required).