程序代写代做 DrRacket ; ! CSC104 Winter 2020 ¡ªExercise #5 ¡ª Print out and fill in by hand, then hand in to the TA at the start of your quiz. !

; ! CSC104 Winter 2020 ¡ªExercise #5 ¡ª 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 :
; Assume the following three definitions …
(define list.A (list 1 (list (list 2 3) 4 5) (list) (list 6 (list 7 8))))
(define list.B (list (list 1 (list) 2 (list 3)) 4 (list (list 5 6 7) 8)))
(define list.C (list (list (list 1) (list 2 3) (list)) (list 4 5) (list (list 6 7)) 8))
;Here’stheliteralfor list.A again,butwithaboxdrawnaroundeachelement: . ; Write out the literals for list.B and list.C again, with a box drawn around each element …
; Here’s a simple assertion, using the literal expression for the value of list.A again, but reformatted so that each element of each list is on its own line …
(same! list.A (list 1
(list (list 2
3) 4
5) (list)
(list 6 (list 7
8))))
; … which is what the ¡°Stack ¡± button does in DrRacket, if you click at the beginning of the list literal and then click that button in the toolbar.
; Do that for the literal expressions for list.B and list.C …
(same! list.B
(same! list.C
; Beside each of the following expressions show its value …
(length list.A)
(length list.B)
(length list.C)
(length (list list.A list.B list.C)) (map length (list list.A list.B list.C))

; Beside each of the following expressions show its value …
(reverse list.A)
(reverse list.B)
(reverse list.C)
;Show,withstandardunderlining,thestepsfor: (step(mapreverse(rest(list1(list(list23)45)(list)(list6(list78))))))
;Assumethefollowingdefinitionhasbeenentered/run… (define(maybe-lengthv) (if (list? v) (length v)
; … then show the steps, with standard underlining, for …
(step (maybe-length “coffee”))
(step (maybe-length (list “coffee” “tea” “water”)))
(step (hide maybe-length) (map maybe-length (list “coffee” “tea” “water”)))
else )) ; that ¡° ¡± is an image, from (solid-rectangle 8 1)

(step (hide maybe-length) (map maybe-length (list 1 (list (list 2 3) 4 5) (list) (list 6 (list 7 8)))))
(step (hide maybe-length) (map maybe-length (list (list 1 (list) 2 (list 3)) 4 (list (list 5 6 7) 8))))
(step (hide maybe-length) (map maybe-length (list (list (list 1) (list 2 3) (list)) (list 4 5) (list (list 6 7)) 8)))