In 2htdp/image the implementations of Sierpinski triangle and carpet are nice 
and simple, which is great for using them in class.


(define (carpet size c)
  (if (<= size 2)
      (square size "outline" c)
      (local [(define sub (carpet (/ size 3) c))
              (define ctr (square (/ size 3) "solid" "white"))]
        (overlay (square size "outline" c)
                 (above (beside sub sub sub)
                        (beside sub ctr sub)
                        (beside sub sub sub))))))

But...  (carpet 200 "red") produces some strange behavior on my Mac. (carpet 
300 "red") is even worse.  The image draws very slowly, which I assume comes 
from the way the image is actually composed of all the composed images rather 
than a single bitmap. But, stranger than that, it seems to need to draw itself 
several times. 

Also I would have thought that 'forcing' the image by actually drawing it would 
save the bitmap so that future drawing was faster. But I may not understand how 
this is actually working.

Is this style of using above, beside and friends to make something this big 
intended to work? Or is there a different style I should be using?


_________________________________________________
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

Reply via email to