# array:fold-right - XPath XQuery Reference

Evaluates the supplied function cumulatively on successive values of the supplied
            array.deterministiccontext-independentfocus-independenthigher-orderThe effect of the function is equivalent to the following recursive definition:
if (array:size($array) eq 0)
then $zero
else $function( array:head($array), 
                array:fold-right(array:tail($array), $zero, $function) 
              )
         array:fold-right([true(), true(), false()], true(), function($x, $y){$x and $y})false()Returns true if every member of the input array has an effective boolean value of true().array:fold-right([true(), true(), false()], false(), function($x, $y){$x or $y})true()Returns true if at least one member of the input array has an effective boolean value of true().array:fold-right([1,2,3], [], function($x, $y){[$x, $y]})[1, [2, [3, []]]]If the supplied array is empty, the function returns $zero.If the supplied array contains a single member $m, the function returns $function($m, $zero).If the supplied array contains two members $m and $n, the function returns 
            $function($m, $function($n, $zero)); and similarly for an input array with more than two members.