;; The first three lines of this file were inserted by DrRacket. They record metadata
;; about the language level of this file in a form that our tools can easily process.
#reader(lib "2017-fall-reader.rkt" "csc104")((modname quiz_v1) (compthink-settings #hash((prefix-types? . #f))))
; CSC104 Quiz: Week 7 (Oct 25)
;
; Last/Family name:
; First/Given name:
; UTORid:
; ★ QUESTION 1.
; f : number → image
(define (f n)
(cond [(= n 0) (triangle 10 "solid" "black")]
[else (above (triangle (* 2 (image-width (f (- n 1))))
"solid" "black")
(f (- n 1)))]))
; ★ Draw the result values of the following three expressions. You do not need to show steps.
(f 0)
(f 1)
(f 2)
; ★ QUESTION 2.
; g : number → image
(define (g n)
(cond [(= n 0) (square 10 "outline" "black")]
[else (beside (above (g (- n 1)) (g (- n 1)))
(square (* 2 (image-height (g (- n 1))))
"outline" "black"))]))
; ★ Draw the result values of the following three expressions. You do not need to show steps.
(g 0)
(g 1)
(g 2)