circles.scm




(define (static-circle x y r . children)
  (lambda ()
    (cons (list x y r)
          (flatmap (lambda (child) (child x y r)) children))))

(define (dynamic-circle r . children)
  (let ((theta (random-theta)))
    (lambda (parent-x parent-y parent-r)
      (set! theta (normalise (+ theta (/ speed r))))
      (let ((self (list (+ parent-x (* (cos theta) (- parent-r r)))
                        (+ parent-y (* (sin theta) (- parent-r r)))
                        r)))
        ((apply static-circle (append self children)))))))

Your browser does not support the HTML CANVAS element.
(define circles
  (static-circle 200 200 20
    (dynamic-circle 35)
    (dynamic-circle 45)
    (dynamic-circle 55)
    (dynamic-circle 70)
    (dynamic-circle 75)
    (dynamic-circle 100)))

Your browser still doesn't support the HTML CANVAS element.
(define circles
  (static-circle 200 200 20
    (dynamic-circle 35
      (dynamic-circle 45
        (dynamic-circle 55
          (dynamic-circle 70
            (dynamic-circle 75
              (dynamic-circle 100))))))))

~ ~ ~