got-word?
that consumes a list of words
and a word and produces true if the given word occurs at least once
in the list.
found-duplicate?
that consumes a list of
words and a word and produces a boolean indicating whether or not the given
word occurs at least twice in the list. (Hint: use your answer to Problem 3)
count-occurrences
that consumes
a list of words and a word and counts the
number of occurrences of the given word in the list.
;; list-to-fbs: list-of-word -> fbs ;; consumes a list of words and produces an fbs that records the number of ;; times the words "fizzle", "bump", and "splat" appear in the list.Here are some test cases you can use to test your function:
(check-expect (list-to-fbs empty) (make-fbs 0 0 0)) (check-expect (list-to-fbs (cons "bump" (cons "bump" (cons "fizzle" empty)))) (make-fbs 1 2 0)) (check-expect (list-to-fbs (cons "splat" (cons "drip" empty))) (make-fbs 0 0 1))(Hint: this function does not strictly follow the template (it doesn't use the operators
first
and rest
on the list-of-words). Most of the functions we'll write this term follow the templates, but occasionally we'll come across one that doesn't.)
Using web-based turnin, turn in a single file containing all code and documentation for this assignment. Name your file according to the naming conventions for files. Put both partners' names and wpi login names in a comment at the top of the file.