G.3.18 Miscellaneous array operations

For the semantics of the parameter ARRY see Conventions of the arrays API.

Function: mbfl_array_reverse DST_ARRY SRC_ARRY

Copy values from SRC_ARRY to DST_ARRY in reverse order.

mbfl_declare_index_array_varref(DST_ARRY)
mbfl_declare_index_array_varref(SRC_ARRY, (a b c d e))

mbfl_array_reverse _(DST_ARRY) _(SRC_ARRY)
mbfl_slots_qvalues(DST_ARRY)    ⇒ e d c b a
Function: mbfl_array_reverse_bang ARRY

Reverse the order of the values in ARRY; this mutates ARRY itself.

mbfl_declare_index_array_varref(ARRY, (a b c d e))

mbfl_array_reverse_bang _(ARRY)
mbfl_slots_qvalues(ARRY)    ⇒ e d c b a
Function: mbfl_array_swap_bang ARRY IDX1 IDX2

Swap the values at indexes IDX1 and IDX2 in the slots of ARRY. This function mutates ARRY itself.

mbfl_declare_index_array_varref(ARRY, (a b c D e F g h i))

mbfl_array_swap_bang _(ARRY) 3 5
mbfl_slots_qvalues(ARRY)        ⇒ a b c F e D g h i
Function: mbfl_array_zip DST_ARRY ARRY1 ARRY2

Zip values from ARRY1 and ARRY2 into DST_ARRY. ARRY1 and ARRY2 must have the same size.

mbfl_declare_index_array_varref(ARRY1, (a b c d e))
mbfl_declare_index_array_varref(ARRY2, (A B C D E))
mbfl_declare_index_array_varref(DST_ARRY)

mbfl_array_zip _(DST_ARRY) _(ARRY1) _(ARRY2)
mbfl_slots_qvalues(DST_ARRY)    ⇒ a A b B c C d D e E
Function: mbfl_array_reset_bang ARRY

Reset to the empty string all the values in ARRY.


This document describes version 3.0.0-devel.9 of Marcos Bash Functions Library.