XQuery Function Documentation

Search and Browse

http://exist-db.org/xquery/sequences

Basic XQuery equivalents of map, fold, and filter functions adapted from the standard library of the Scheme programming language. Demonstrates the use of higher-order functions in eXist.

seq:filter

seq:filter($func as function, $seq as item()*) as item()*

Filters the passed sequence by calling $func for every item. All items for which $func returns true are copied to the output sequence, items for which it returns false are skipped.

Parameters:
$func $func
$seq* $seq*
Returns:
item()*

seq:fold

seq:fold($func as function, $seq as item()*, $start as item()) as item()*

Calls $func for all items in the sequence. For example, if the sequence is (1, 2, 3), $func will be called with arguments (1, 2) and (3, 3).

Parameters:
$func $func
$seq* $seq*
$start $start
Returns:
item()*

seq:map

seq:map($func as function, $seqA as item()*, $seqB as item()*) as item()*

Applies $func to the items of two sequences and returns the results as a new sequence. Both input sequences should have the same length.

Parameters:
$func $func
$seqA* $seqA*
$seqB* $seqB*
Returns:
item()*