MarkLogic 12 EA 1 Product Documentation
fn:reverse

fn:reverse(
   $target as item()*
) as item()*

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.

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

let $x := ("a", "b", "c")
return
fn:reverse($x)

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

Example

fn:reverse(("hello"))

=> ("hello")

Example

fn:reverse(())

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