previous | index | next

Vector Example 1

     (define v (make-vector 17))

     ; Find out how many locations
     (vector-length v) ⇒ 17

     ; Store a 7 into location 13
     (vector-set! v 13 7)

     ; Retrieve what's in location 13
     (vector-ref v 13) ⇒ 7

     ; Put a 3 into the first location
     (vector-set! v 0 3)

     ; See that location 13 still intact
     (vector-ref v 13) ⇒ 7

     ; Now clobber it
     (vector-set! v 13 0)

     ; See that location 13 did change
     (vector-ref v 13) ⇒ 0

previous | index | next