Question
(@problem 6) ;; ;; NOTE: Do not attempt to solve this problem until you have covered ;; the How to Design Functions (HtDF) design recipe
(@problem 6) ;; ;; NOTE: Do not attempt to solve this problem until you have covered ;; the How to Design Functions (HtDF) design recipe in lecture. ;; ;; Design a function called taller-image that consumes two images and produces ;; the image that has the greater height. ;; ;; Note that the template tag for a function that consumes two images is: ;; ;; (@template Image) ;; ;; and the template itself is: ;; ;; (define (taller-image i1 i2) ;; (... i1 i2)) ;;
;(@htdf taller-image) ;Uncomment this line when you start the problem.
-------------------------------------------------------------------------------------------------
I wrote the answer like this
(@htdf taller-image)
(@signature Image Image -> Image) ;; Produces the image that has the greater height given two images (check-expect (taller-image (rectangle 2 3 "solid" "red") (rectangle 3 2 "solid" "red")) (rectangle 2 3 "solid" "red")) (check-expect (taller-image (rectangle 4.2 7.6 "solid" "red") (rectangle 7.6 4.2 "solid" "red")) (rectangle 4.2 7.6 "solid" "red")) (check-expect (taller-image (rectangle 1 2 "solid" "red") (rectangle 2 1 "solid" "red")) (rectangle 1 2 "solid" "red"))
;(define (taller-image i1 i2 ) empty-image) ;stub
;(define (taller-image i1 i2) ;template ; (... i1 i2))
(@template Image) (define (taller-image i1 i2) (if (< (image-height i1) (image-height i2)) i2 i1))
--------------------------------------------------------------------------------
And then I test it
the result says
AUTOGRADING GRADE: 96%. In (@Problem 6), in (@htdf taller-image), insufficient tests - failed to detect 2 of our buggy functions
what is the correct answer?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started