Returns an array whose size is the same as array:size($array)
, in which
each member is computed by applying $function
to the corresponding member of
$array
.
array:for-each
( $array
as array(*)
,$action
as function(item()*) as item()*
array(*)
Returns the result of the expression:
array:join( (1 to array:size($array)) ! [ $action($array(.)) ] )
The expression array:for-each(["A", "B", 1, 2], function($z) {$z instance of xs:integer})
returns [false(), false(), true(), true()]
.
The expression array:for-each(["the cat", "sat", "on the mat"], fn:tokenize#1)
returns [("the", "cat"), "sat", ("on", "the", "mat")]
.