Loading TOC...

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(())

=> ()

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.