Due: Thursday 10/30 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
gis a list of numbers andvalueis a number. - Returns the number of times
valueappears ing.
- Assume
(listMin g currentMin)- Assume
gis a list of numbers andcurrentMinis a number. - Returns the smallest value in
g. - To test this, you’ll need to use
currentMineffectively. Initially, you’ll want a value larger than any other possible value.+inf.0is a valid value in Racket representing the smallest possible value.
- Assume
(countDown n)- Assume
nis a positive integer. - Returns a list containing all the integers from
nto0.
- Assume
(doublify g)- Assume
gis a list containing only numbers. - Returns a list containing the values of
gtimes 2.
- Assume
(myMap f g)- Assume
fis a function andgis a list. - Works the same way as
map, so it should return a new list wherefis applied to each element ofg.
- Assume
(reverse-build-list n f)- Assume
nin a positive integer andfis a function. - Works like
build-listbut 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?
- Assume