Array.zip
zipthatfunctionon_problems
Group: Calculations
Aliases: combine
, join by row position
, merge
Documentation
Performs a pair-wise operation passed in function
on consecutive elements of self
and that
.
The result of this function is a Vector
of length being the shorter of self
and that
, containing results of calling function
.
Arguments
that
: The array to zip withself
.function
: The function used to combine pairwise elements ofself
andthat
.on_problems
: Specifies how to handle any problems that arise infunction
.
Examples
Calculate the pairwise sum of two arrays.
[1, 2, 3].to_array.zip [4, 5, 6].to_array (+)
When the function
is not provided, it defaults to creating a pair
of both elements.
[1, 2, 3].to_array.zip [4, 5, 6].to_array == [[1, 4].to_array, [2, 5].to_array, [3, 6].to_array].to_array
Errors
The result of Errors thrown when executing the function depend on
on_problems
:
- Report_Error: The first error is thrown, and is wrapped in
Map_Error
. - No_Wrap: The first error is thrown, and is not wrapped in
Map_Error
. - Report_Warning: The result for that element is
Nothing
, the error is attached as a warning. Currently unimplemented. - Ignore: The result is
Nothing
, and the error is ignored.
Errors that are thrown when executing the supplied function are wrapped
in Map_Error
, which contains the index at which the error occurred.
In the Report_Warning
case, only MAX_MAP_WARNINGS
warnings are attached to result values. After that, the warnings are
dropped, but a count of the additional warnings is attached in an
Additional_Warnings
warning.