@JRubyMethod(required=1, optional=1)
public IRubyObject fetch(ThreadContext context, IRubyObject args[], Block block) {
Long index = (Long)args[0].toJava(Long.class);
try {
Var var = DiametricService.getFn("clojure.core", "nth");
// counting vector size will be costly when the vector is way huge.
// allows to raise exception for negative or too big index
Object value = var.invoke(vector_or_seq, index);
return DiametricUtils.convertJavaToRuby(context, value);
} catch (Throwable t) {
if (t instanceof IndexOutOfBoundsException) {
return retryFetch(context, args, block, index);
}