This is an old revision of the document!
Learn the basics of the Racket lists and various patterns of recursion:
You will again use DrRacket, which you should have downloaded and installed for the previous lab.
For this lab, you will need to implement the following functions and data structures in Racket:
check-temps1
check-temps
convert
duple
average
convertFC
eliminate-larger
get-nth
find-item
(define (check-temps1 temps) ...)
where temps
is a list of numbers representing temperatures and the value returned is a boolean indicating whether all of the temperatures are with the range 5 to 95 inclusive.
(define (check-temps temps low high) ...)
where temps
is a list of numbers representing temperatures and the value returned is a boolean indicating whether all of the temperatures are with the range low
to high
inclusive.
(define (convert digits) ...)
where digits
…
(define (duple lst) ...)
where lst
…
(define (average lst) ...)
where lst
…
(define (convertFC temps) ...)
where temps
…
(define (eliminate-larger lst) ...)
where lst
…
(define (get-nth lst n) ...)
where lst
and n
…
You again do not need to bulletproof the code to enforce proper inputs. Your code only needs to return correct values given correct inputs.
You may want to again use Step button to walk through your code and watch the equivalent sequence of substitutions that are performed. This is particularly useful in tracing the recursion and watching what's happening to the parameters.
Again use check-expect
to write your own unit tests for your code.