Changes

Jump to navigation Jump to search
no edit summary
function($x) { $x >= 10 }
)
</syntaxhighlight>
|}
 
==hof:drop-while==
 
{{Mark|Introduced with Version 9.5.}}
 
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|hof:drop-while|$seq as item()*, $pred as function(item()) as xs:boolean|item()*}}
|-
| '''Summary'''
|The function skips all items of <code>$seq</code> until the predicate <code>$pred</code> is not satisfied anymore. It is equivalent to:
<syntaxhighlight lang="xquery">
declare function hof:drop-while($seq, $pred) {
if($pred(head($seq))) then (
hof:drop-while(tail($seq), $pred)
) else (
$seq
)
};
</syntaxhighlight>
|-
| '''Examples'''
|Returns the name of the first file that does not exist on disk:
<syntaxhighlight lang="xquery">
hof:drop-while(
(1 to 1000) ! (. || '.log'),
file:exists#1
)[1]
</syntaxhighlight>
|}
|-
| '''Summary'''
|Returns its argument unchanged. This function isn't isn’t useful on its own, but can be used as argument to other higher-order functions.
|-
| '''Examples'''
|-
| '''Summary'''
|Returns its first argument unchanged and ignores the second. This function isn't isn’t useful on its own, but can be used as argument to other higher-order functions, e.g. when a function combining two values is expected and one only wants to retain the left one.
|-
| '''Examples'''
=Changelog=
 
;Version 9.5
* Added: [[#hof:drop-while|hof:drop-while]]
;Version 8.1
 
* Added: [[#hof:scan-left|hof:scan-left]], [[#hof:take-while|hof:take-while]]
;Version 7.2
 
* Added: [[#hof:top-k-by|hof:top-k-by]], [[#hof:top-k-with|hof:top-k-with]]
* Removed: hof:iterate
;Version 7.0
 
* module added
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu