Loading TOC...

fn.reverse

fn.reverse(
   $target as ValueIterator
) as ValueIterator

Summary

Reverses the order of items in a sequence. If $arg is the empty sequence, the empty sequence is returned.

For detailed type semantics, see Section 7.2.12 The fn:reverse function[FS].

Parameters
$target The sequence of items to be reversed. If you pass in a single value, it is treated as a ValueIterator with that single item; therefore, if you pass in an array, the array is treated as a single value (not as one value for each item in the array). If you mean to pass in the values of each item in the array, then you can call xdmp.arrayValues on the array.

Usage Notes

The sequence you specify to reverse must fit into memory, so the sequence size should not be larger than your memory cache sizes.

Example

var x = xdmp.arrayValues(["a", "b", "c"]);
fn.reverse(x);

=> ("c", "b", "a")

Example

fn.reverse("hello")

=> ("hello")

Example

fn.reverse(null)

=> ()

Comments

    Powered by MarkLogic Server 7.0-4.1 and rundmc | Terms of Use | Privacy Policy