Changes

Jump to navigation Jump to search
438 bytes added ,  22:10, 9 August 2014
no edit summary
| '''Summary'''
| Evaluates the supplied {{Code|$function}} cumulatively on successive members of the supplied {{Code|$array}} from left to right and using {{Code|$zero}} as first argument.
|-
| '''Examples'''
|The following query returns {{Code|55}} (the sum of the integers 1 to 10):
<pre class="brush:xquery">
array:fold-left(
array { 1 to 10 },
0,
function($a, $b) { $a + $b }
)
</pre>
|}
| '''Summary'''
| Evaluates the supplied {{Code|$function}} cumulatively on successive members of the supplied {{Code|$array}} from right to left and using {{Code|$zero}} as first argument.
|-
| '''Examples'''
|The following query is equivalent to the expression <code>array:reverse(array { 1 to 5 }</code>:
<pre class="brush:xquery">
array {
array:fold-right(array { 1 to 5 }, (), function($a, $b) { $b, $a })
}
</pre>
|}
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu