uniqind#
uniqind($pdl) — return flat indices of unique elements. Mirrors PDL::uniqind from Primitive.pm:727-756.
Semantics:
Flatten input.
NaN indices go at the end of the result (NaN is never equal to itself).
Among non-NaN values: sort by value (stable → first-occurrence wins), find positions where sorted values change (rotate-minus-one diff), map those back through the sort permutation to original indices.
Empty input → returns input unchanged.