CSC104H1 Lecture Notes - Lecture 6: Sierpinski Triangle

34 views2 pages
26 Sep 2016
School
Course

Document Summary

; recursion : the sierpinski triangle, part iii (require picturing-programs) ; let"s step our function s". (define (stack an-image) (above an-image (beside an-image an-image))) (define (s n) (cond [(= n 0) ] [else (stack (s (- n 1)))])) (s 0) (cond [(= 0 0) ] [else (stack (s (- 0 1)))]) (cond [#true ] [else (stack (s (- 0 1)))]) (s 1) (cond [(= 1 0) ] [else (stack (s (- 1 1)))]) (cond [#false ] [else (stack (s (- 1 1)))]) (cond [else (stack (s (- 1 1)))]) (stack (s (- 1 1))) (stack (s 0)) ; we know (s 0) is from before, so we"ll skip those steps here: (stack ) (above (beside )) (above (s 2) (cond [(= 2 0) ] [else (stack (s (- 2 1)))]) (cond [#false ] [else (stack (s (- 2 1)))]) (stack (s (- 2 1))) (stack (s 1))

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
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Questions