2014年10月27日星期一

Week - OCTOBER 20

Last week we learn Sierpinski triangle - an interesting triangle model!                                                  

There is an example:

(require picturing-programs)
(triangle 25 "solid" "red")


(define (stack an-image)
          (above an-image (beside an-image an-image)))

(define (Sierpinski n)
     (cond [ ( zero? n ) 🔺]
               [else (stack ( Sierpinski (- n 1)))]))
-------------------------------------------
(stack (Sierpinski (- 1 1)))

•it will appears a big triangle with four small equally triangle.
That because (Sierpinski 0) is a single triangle, (stack 0) means repeated addition other three triangles (a big triangle with four small equally triangle)

没有评论:

发表评论