Functions Index :: A :: ArrayDistinct
Module:
array :: transforms
Definition:
ArrayDistinct(string array, string "cmp_func", string "cmp_args", string "avg_func", string "avg_args")
Description:
Returns the subset of array with only distinct elements in it. The resulting array is always returned in ascending sort order (ie a[i] < a[i+1] for all i).
Arguments:
array: The array from which distinct elements are sought.
cmp_func (optional): A custom comparison function which must accept two val arguments at the start of its list and return -1,0,1 if arg1 < arg2, arg1 == arg2, arg1 > arg2, respectively.
cmp_args (optional): Any extra arguments needed by cmp_func as a string.
avg_func (optional): A custom average function (to be used by the sorting algorithm) which must accept two val arguments at the start of its list and return the average value of them.
avg_args (optional): Any extra arguments needed by avg_func as a string.
Examples:
a1 = ArrayCreate(1,2,3,2,3,3,5,6,7,8,5,5,6)
a2 = a1.ArrayDistinct()
# a2 == "1,2,3,5,6,7,8"