Array.duplicates
duplicateson
Group: Selections
Aliases: duplicates
Documentation
Returns only non-unique elements within the array.
The returned duplicate elements are kept in the same order as the first duplicate appeared in the input.
Arguments
on
: A projection from the element type to the value of that element which determines the uniqueness criteria.
Examples
Removing unique entries.
[1, 3, 1, 2, 2, 1].to_array . duplicates == [1, 1, 2, 2, 1].to_array