[plt-scheme] frtime slowing down

From: Dave Griffiths (dave at pawfal.org)
Date: Fri Mar 21 19:49:29 EDT 2008

Hi Greg, all,

Why does the following code slowly use more and more cpu? I'm assuming
that although visually the circles are being removed, something remains
which is getting processed.

(require (lib "animation.ss" "frtime"))

(define (metro tick)
  (let ((tick (floor (* tick 1000))))
    (when-e (> (modulo (floor milliseconds) tick) (/ tick 2)))))

(define (truncate-list lst count)
  (cond 
    ((zero? count) '())
    ((null? lst) '())
    (else (cons (car lst) (truncate-list (cdr lst) (- count 1))))))
 
(display-shapes
 (list
  (collect-b
   (metro 0.1) '()
   (lambda (e lst)
     (cons (make-circle (make-posn 50 (+ 50 (integral 0.2))) 10 "red")
           (truncate-list lst 4))))))

cheers,

dave



Posted on the users mailing list.