;; draws pretty pictures, makes a great gift. (define draw-every 1000) ; update screen every N points (define (HOP a b c) (let loop ((x 0) (y 0) (counter 0) (color (next-color))) (let ((update? (zero? (modulo counter draw-every)))) (when update? (xflush *dpy*)) ; following two lines are the actual Hopalong algorithm: (let ((new-x (- y (* (sign x) (sqrt (abs (- (* b x) c)))))) (new-y (- a x))) (draw-point new-x new-y color) (loop new-x new-y (modulo (+ counter 1) draw-every) (if update? (next-color) color)))))) (define (SIGN x) (if (negative? x) -1 1))