chickadee » scheme » vector-ref

vector-ref vector kprocedure

k must be a valid index of vector. Vector-ref returns the contents of element k of vector.

(vector-ref '#(1 1 2 3 5 8 13 21)
            5)  
                ===>  8
(vector-ref '#(1 1 2 3 5 8 13 21)
            (let ((i (round (* 2 (acos -1)))))
              (if (inexact? i)
                  (inexact->exact i)
                  i))) 
                ===> 13