G.3.10 Removing and deleting values

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

Function: mbfl_array_remove DST_ARRY SRC_ARRY IDX

Copy values from SRC_ARRY to DST_ARRY skipping the value at index IDX. The parameters DST_ARRY and SRC_ARRY can represent the same array, in which case: the array is mutated; the slot is removed; the array is one slot shorter.

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

mbfl_array_remove _(RESULT) _(ARRY) 3

mbfl_slots_qvalues(RESULT)      ⇒ a b c e f g h i
Function: mbfl_array_delete DST_ARRY SRC_ARRY VALUE
Function: mbfl_array_delete DST_ARRY SRC_ARRY VALUE ISEQUAL

Copy values from SRC_ARRY to DST_ARRY skipping the values equal to VALUE according to ISEQUAL.

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

mbfl_array_delete _(RESULT) _(ARRY) D

mbfl_slots_qvalues(RESULT)      ⇒ a b c e f g h i
Function: mbfl_array_delete_duplicates DST_ARRY SRC_ARRY
Function: mbfl_array_delete_duplicates DST_ARRY SRC_ARRY ISEQUAL

Copy values from SRC_ARRY to DST_ARRY skipping all the duplicate values according to ISEQUAL. If a value is present multiple times: its leftmost occurrence is stored in DST_ARRY, while all the others are discarded; this way the original unique–values left–to–right order is preserved.

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

mbfl_array_delete_duplicates _(RESULT) _(ARRY)

mbfl_slots_qvalues(RESULT)      ⇒ a b c D e f g h i

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