CSC104H1 Lecture Notes - Lecture 7: Animage
Document Summary
; repeated : function any number list. ; (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)))])) (require picturing-programs) ; here"s a function that does nothing to an image. ; leave-alone : image image (define (leave-alone an-image) an-image) (check-expect (repeated leave-alone. 5) (list (leave-alone (leave-alone (leave-alone (leave-alone (leave-alone (leave-alone (leave-alone (leave-alone (leave-alone (leave-alone (check-expect (repeated leave-alone. ; by doing nothing in the on-tick" transformation we can see the isolated effect of the to-draw". ; for example, putting flip-vertical" in the to-draw" will show the unchanging star upside-down. ; recall that it"s like doing a map": (check-expect (map flip-vertical (repeated leave-alone. 5)) (map flip-vertical (list (check-expect (map flip-vertical (repeated leave-alone. 5)) (list (flip-vertical (flip-vertical (flip-vertical (flip-vertical (flip-vertical (check-expect (map flip-vertical (repeated leave-alone.