(import sparse-vectors (chicken random)) (define (main maxi) (let* ((sv (make-sparse-vector)) (indices '()) (high 0)) (print "filling ...") (do ((i 0 (add1 i))) ((>= i 10000)) (let ((j (pseudo-random-integer maxi))) (set! high (max high j)) (sparse-vector-set! sv j j) (set! indices (cons j indices)))) (print "checking (highest = " high ") ...") (do ((i indices (cdr i))) ((null? i)) (let ((j (car i))) (assert (= j (sparse-vector-ref sv j))))))) (time (main 1000000000)) (time (main 1000000000000000000000))