PasteRack.org
Paste # 36451
2024-12-11 13:33:49

Forked from paste # 14930.

Fork as a new paste.

Paste viewed 94 times.


Embed:

Sierpinski

  1. #lang racket  ; A picture
  2. (require 2htdp/image)
  3. (define (sierpinski [n 8] [t-size 2])
  4.   (cond [(zero? n) (triangle t-size 'solid 'darkgreen)]
  5.         [else
  6.          (define t (sierpinski (- n 1) t-size))
  7.          (freeze (above t (beside t t)))]))
  8. (sierpinski 7 2)

=>

image