Changes

Jump to navigation Jump to search
==hof:fold-left1==
 
{{Mark|Updated with Version 7.7:}} the arguments have been swapped, similar to the standard [[Higher-Order Functions]].
 
{| width='100%'
|-
| width='90' | '''Signatures'''
|{{Func|hof:fold-left1|$seq as item()+, $f as function(item()*, item()) as item()*, $seq as item()+|item()*}}
|-
| '''Summary'''
|Works the same as [[Higher-Order_FunctionsOrder Functions#fn:fold-left($f, $seed, $seq)|fn:fold-left($f, $seed, $seq)]], but doesn't need a seed, because the sequence must be non-empty.
|-
| '''Examples'''
|
* {{Code|hof:fold-left1(1 to 10, function($a, $b) { $a + $b }, 1 to 10)}} returns {{Code|55}}.* {{Code|hof:fold-left1((), function($a, $b) { $a + $b }, ())}} throws {{Code|XPTY0004}}, because {{Code|$seq}} has to be non-empty.
|}
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu