| 17 POINTS |
Problem$^a$ 2. The main purpose of this exercise is to develop the function list->oos. It consumes a list of basic event symbols ('on, 'off, 'steady); its result is an oos structure that represents how many times 'on, 'steady, and 'off, respectively, occur in the given list.
(define-struct oos (on steady off)) ;; A OOS is: ;; -- (make-oos NaturalNumber NaturalNumber NaturalNumber)
Answer the following questions:
Name the constructor, predicate, and selectors that the structure definition for oos introduces.
Solution
;; [PT 2: 1 if they mention fewer and no junk] make-oos oos? oos-on oos-steady oos-off
Provide a template for a function that consumes an OOS structure.
Solution
;; [PT 1, for all selector expressions] ;; program: OOS -> ??? (define (program an-oos) ... (oos-on an-oos) ... (oos-steady an-oos) ... (oos-off an-oos) ...)