For the semantics of a “foreach iteration” see Conventions of the arrays API. For the semantics of a “multi iteration” see Conventions of the arrays API. For the semantics of a “left iteration” see Conventions of the arrays API. For the semantics of a “right iteration” see Conventions of the arrays API.
For the semantics of the parameter OPERATOR see Conventions of the arrays API. For the semantics of the parameter ARRY see Conventions of the arrays API. For the semantics of the parameter ARRYS see Conventions of the arrays API.
Apply OPERATOR to all the values from ARRY for the purpose of generating some side effects. OPERATOR is used in a command line as follows:
OPERATOR VALUE
where VALUE is a value from the array.
mbfl_declare_index_array_varref(ARRY, (a b c)) mbfl_array_left_foreach echo _(ARRY) -| a -| b -| c
Apply the OPERATOR to every tuple of values in homologous slots from ARRYS for the purpose of generating some side effect. OPERATOR is used in a command line as follows:
OPERATOR HOMOLOGOUS_VALUES
where HOMOLOGOUS_VALUES is an indexed array containing values from the homologous slots of ARRYS.
function OPERATOR () { mbfl_mandatory_nameref_parameter(ITEMS, 1, reference to index array of homologous values) declare -i I VALUE=0 for ((I=0; I < mbfl_slots_number(ITEMS); ++I)) do let VALUE+=mbfl_slot_ref(ITEMS, $I) done echo "$VALUE" } mbfl_declare_index_array_varref(ARRY1, (1 2 3 4)) mbfl_declare_index_array_varref(ARRY2, (10 20 30 40)) mbfl_declare_index_array_varref(ARRY3, (100 200 300 400)) mbfl_declare_index_array_varref(ARRYS, (_(ARRY1) _(ARRY2) _(ARRY3))) mbfl_array_multi_left_foreach OPERATOR _(ARRYS) -| 111 -| 222 -| 333 -| 444
This document describes version 3.0.0-devel.9 of Marcos Bash Functions Library.