For the semantics of the parameter ARRY see Conventions of the arrays API.
Given the already declared index array ARRY, fill the slots from index ‘0’ included to index NUM_OF_SLOTS excluded.
When the parameter INITIALISER is not given: each slot’s value is its index itself.
mbfl_declare_index_array_varref(ARRY) mbfl_array_tabulate _(ARRY) 5 mbfl_slots_qvalues(ARRY) ⇒ 0 1 2 3 4
When the parameter INITIALISER is given: each slot’s value is generated with the command line:
INITIALISER RV IDX
where: IDX is the index of the slot to fill; RV is the result variable to be set to the new slot’s value. If INITIALISER returns false: the function returns immediately with return status equal to the return status of INITIALISER.
function initialiser () { mbfl_mandatory_nameref_parameter(RV, 1, result variable) mbfl_mandatory_parameter(IDX, 2, slot index) let RV=100*IDX return_success } mbfl_declare_index_array_varref(ARRY) mbfl_array_tabulate _(ARRY) 5 initialiser mbfl_slots_qvalues(ARRY) ⇒ 0 100 200 300 400
Given the already declared index array ARRY, fill the slots from index ‘0’ included to index NUM_OF_SLOTS excluded. The slots’ values are computed with an equivalent of:
mbfl_math_expr "$START+$STEP*$IDX"
where the optional parameters START and STEP default to ‘0’ and ‘1’.
mbfl_declare_index_array_varref(ARRY) mbfl_array_iota _(ARRY) 5 mbfl_slots_qvalues(ARRY) ⇒ 0 1 2 3 4 mbfl_array_iota _(ARRY) 5 10 5 mbfl_slots_qvalues(ARRY) ⇒ 10 15 20 25 30 mbfl_array_iota _(ARRY) 5 1.0 0.1 mbfl_slots_qvalues(ARRY) ⇒ 1 1.1 1.2 1.3 1.4
This document describes version 3.0.0-devel.9 of Marcos Bash Functions Library.