7 POINTS

Problem$^a$ 1.  Take a look at these structure and data definitions:

(define-struct message (slot cont))
;; An Message is one of: 
;; -- Symbol
;; -- String 
;; -- (make-message NaturalNumber String)

Answer the following questions in this context:

  1. Write down the constructor and predicate that the structure definition introduces:

    Solution [PT 2]

    make-message message? 

  2. Write down three distinct data examples, one per clause:

    Solution [PT 1]

        'hello    "world"      (make-message 10 'hello)
    

  3. Write down the template for a function that consumes a Message:

    ;; program : Message -> ???
    

    Solution [PT 2: 1 for three cond lines, 1 for selector expressions]

    (define (program e)
      (cond
        [(symbol? e) ...]
        [(string? e) ...]
        [else (message-slot e) ... (message-cont e)]))