PING
0.9
Statistical data handling and processing in production environment
|
Extract elements from a formatted list at given position(s).
clist
: a formatted (e.g., parentheses-enclosed, comma-separated quote-enhanced) list;index
: a list of numeric indexes providing with the positions of items to extract from list
; must that the values of items in index
should be < length of the list and >0;mark, sep
: (option) characters/strings used respectively as a "quote" and a separator in the input list; default: mark=
str(%"), and" sep=%quote(,)
, i.e. clist
is a comma-separated list of quote-enhanced items; see %clist_unquote for further details.res
: output list defined as the sequence of elements extract from the input list list
so that:
i
-th element in res
is equal to the j
-th element of list
where the position j
is given by the i
-th element of index
. returns: res=("ccc","bb","bb","dddd","a")
since the index 100 is ignored.
Run macro %_example_clist_index
for more examples.
clist
are ignored, while whenever one index is <0, and error is generated.res
returned is empty (i.e. res=
).$
appears somewhere in the list. If you need to use $
, you can reset the global macro variable G_PING_UNLIKELY_CHAR
(see _setup_
file) to another dumb (unlikely) character of your own.%list_index, %clist_slice, %clist_compare, %clist_append, INDEX.