/* * call-seq: * dvector.fetch(int) -> number * dvector.fetch(int, default ) -> number * dvector.fetch(int) {|index| block } -> number * * Tries to return the element at index <i>int</i>. If the index * lies outside the vector, the first form throws an * <code>IndexError</code> exception, the second form returns * <i>default</i>, and the third form returns the value of invoking * the block, passing in the index. Negative values of the index * count from the end of the vector. * * a = Dvector[ 11, 22, 33, 44 ] * a.fetch(1) -> 22 * a.fetch(-1) -> 44 * a.fetch(4, 0) -> 0 * a.fetch(4) { |i| i*i } -> 16 */ VALUE dvector_fetch(int argc, VALUE *argv, VALUE ary) {