CSC104H1 Midterm: practice 1

129 views1 pages
26 Sep 2016
School
Course

Document Summary

; csc 104 2016 winter week 7 quiz preparation, part i : answers list* : ; in monday"s lecture we saw a function repeated" with contract. ; (repeated f a n) produces (list a (f a) (f (f a)) ) with n" elements. (define (repeated f a n) (cond [(= n 1) (list a)] [else (list* a (repeated f (f a) (- n 1)))])) ; for example: (check-expect (repeated sqr 3 4) (list 3 (sqr 3) (sqr (sqr 3)) (sqr (sqr (sqr 3))))) (check-expect (repeated sqr 3 4) (list 3 9 81 6561)) list (require picturing-programs) ; show the intermediate steps and result value of the recursion for the following expression. ; you may skip showing how cond" is choosing which clause to use, but make sure to show each. ; intermediate list*" expression. (repeated rotate-ccw (triangle 10 outline black) 3)

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers

Related Documents