Class 7 Objectives


At the end of today's class you should

KNOW:

BE ABLE TO:

Vocabulary: template, itemization

Sample Exam Question:

Use the animal-func template from class to write a function change-product-info that consumes an animal, an item, and a company, and produces an animal the same as the original but with new product information. If the animal doesn't keep product information, return an animal the same as the original. Here are a couple of test cases:

(check-expect (change-product-info (make-tiger "Fluffy" 30 (make-product "gas" "Exxon"))
                     "Frosted Flakes"
                     "General Mills")
(make-tiger "Fluffy" 30 (make-product "Frosted Flakes" "General Mills"))

(check-expect (change-product-info (make-boa "Slinky" 25 "granola") "GI Joe" "Hasbro") (make-boa "Slinky" 25 "granola"))