Due: Monday 10/28 10:00am

Submission name: work17.rkt

Write the following functions using recursion. The only list-specific functions you should use are first, rest, list, null?, and cons. Include multiple test cases for each function.

  • (count value g)
    • Assume g is a list of numbers and value is a number.
    • Returns the number of times value appears in g.
  • (listMin g currentMin)
    • Assume g is a list of numbers and currentMin is a number.
    • Returns the smallest value in g.
    • To test this, you’ll need to use currentMin effectively. Initially, you’ll want a value larger than any other possible value. +inf.0 is a valid value in Racket representing the smallest possible value.
  • (countDown n)
    • Assume n is a positive integer.
    • Returns a list containing all the integers from n to 0.
  • (doublify g)
    • Assume g is a list containing only numbers.
    • Returns a list containing the values of g times 2.
  • (myMap f g)
    • Assume f is a function and g is a list.
    • Works the same way as map, so it should return a new list where f is applied to each element of g.
  • (reverse-build-list n f)
    • Assume n in a positive integer and f is a function.
    • Works like build-list but in reverse, so the first element should be (f n) and the last should be (f 0).
    • Question to ponder: What would you need to do to get this to work the same way as build-list?