; ! CSC104 Winter 2020 —Exercise #3 — Print out and fill in by hand, then hand in to the TA at the start of your quiz. !
; UTorID (login ID) : ; Surname : ; Given Name :
; ! Part A. Show all the following steps.
;Youdonotneedtoincludethe “!Steps!”,“○”,nor“•”punctuationthatDrRacketshowswhenusing step.
; Include ALL the underlining of sub-expressions that will change.
; In DrRacket, the step operation starts by copying the expression given to step so that it can add the underlining ; for that initial expression, but you may save some effort by adding the initial underlining directly to the original
; expression inside (step ⋯ ) rather than recopying that expression.
(step (combine + (map – (range 5))))
(step (combine * (map + (range 2 5))))
(step (map solid-triangle (range 15 16)))
(step (combine
solid-square (range 10 11)))
(step (combine
rectangle (range 10 40 15)))
(step (combine
(step (map
(step (combine
list (list text-length “ant” list flip )))
list (list text-length “ant” list flip )))
beside (map above (map mirror (list
)))))
(step (combine above (map text->image (map text-join (list “ant” “bear” “ox”)))))
(step (above (text->image (combine text-join (list “ant” “bear” “ox”)))))
;!PartB.
; For each of the following function definitions, EITHER :
; •CIRCLE“GrammaticallyIncorrect”ifitisnotaproperlyformeddefinition(i.e.causesanerroronitsown),OR
; •FILLINthetwoassertionsandshowthestepsforthegivenfunctioncall,includinganyerrormessagethatoccursduringthosesteps.
(define (f.1 10) (oval 20 10))
;GrammaticallyIncorrect OR
(same! (unary? f.1) (same! (binary? f.1) (step (f.1 20))
(define (f.2 x) (oval 20 10))
;GrammaticallyIncorrect OR
) (same! (unary? f.2) ) (same! (binary? f.2)
(step (f.2 “1000”))
(define (f.3 “text”) (text-join “text” “!”))
;GrammaticallyIncorrect OR
) (same! (unary? f.3) ) ) (same! (binary? f.3) )
(step (f.3 “text”))
(define (f.4 (list a (turn (triangle a)
; Grammatically Incorrect
b)) b))
OR
(define (f.5 (list a b)) (map circle (list a b)))
(define (f.6 a b) (map circle a b))
;GrammaticallyIncorrect OR
) (same! (unary? f.6) ) (same! (binary? f.6)
(step (f.6 10 15))
(define (f.9 a)
(map circle (list a)))
;GrammaticallyIncorrect OR
) (same! (unary? f.9) ) (same! (binary? f.9)
(step (f.9 10 20))
(define (f.12 amy) (text-join amy “!”))
;GrammaticallyIncorrect OR
) (same! (unary? f.12) ) (same! (binary? f.12) (step (f.12 “clara”))
(define (f.15 amy) (list amy “amy”))
;GrammaticallyIncorrect OR
) (same! (unary? f.15) ) (same! (binary? f.15) (step (f.15 “clara”))
(same! (unary? f.4) (same! (binary? f.4) (step (f.4 (list 10 15)))
(define (f.7 a b)
(map circle (list b a)))
) )
) )
; Grammatically Incorrect
(same! (unary? f.7) (same! (binary? f.7) (step (f.7 10 15))
(define (f.10 a b) scale a b)
; Grammatically Incorrect
OR
OR
(same! (unary? f.10) (same! (binary? f.10) (step (f.10 (star 10) 20))
(define (f.13 amy) amy “amy”)
;GrammaticallyIncorrect OR
(same! (unary? f.13) (same! (binary? f.13) (step (f.13 “clara”))
) )
) )
OR
) )
(same! (unary? f.8) (same! (binary? f.8) (step (f.8 (list 10 15)))
(define (f.11 amy) (text-join “amy” “!”))
;GrammaticallyIncorrect OR
(same! (unary? f.11) (same! (binary? f.11) (step (f.11 “clara”))
(define (f.14 amy) (text-join amy “amy”))
;GrammaticallyIncorrect OR
(same! (unary? f.14) (same! (binary? f.14) (step (f.14 “clara”))
) )
) )
) )
; Grammatically Incorrect
(same! (unary? f.5) (same! (binary? f.5) (step (f.5 10 15))
(define (f.8 a) (map circle a))
; Grammatically Incorrect
OR