MarkLogic 12 EA 1 Product Documentation
vec:get

vec:get(
   $vector1 as vec:vector,
   $k as xs:unsignedInt
) as xs:float

Summary

Returns the element at the k-th index of the vector.

Parameters
vector1 The vector to grab the k-th element of.
k The zero-based index of vector1 to return. If k is greater than the number of elements in the vector, throw VEC-OUTOFBOUNDS.

Example

  xquery version "1.0-ml";
  let $vec1 := vec:vector((3.14,1.59,2.65))
  return vec:get($vec1, 1)

  => 1.59
Powered by MarkLogic Server | Terms of Use | Privacy Policy