On Wed Apr 01 14:36:34 2015, ETHER wrote:
Show quoted text> > I'm not sure I like the idea of a single "uniq" function that doesn't
> > clearly specify whether it performs stringy or numerical, or even
> > referential identity comparisons to reduce equivalent members.
> >
> > uniq 123, "123.0"
> >
> > should return a one or two-element list?
Given the rest of perl, I think stringy comparison is the non-surprising choice.
Show quoted text> What about an optional first parameter which is a coderef that does
> the equality check? e.g.
>
> uniq { $a cmp $b } 123, "123.0" # returns two elements
> uniq { $a <=> $b } 123, "123.0" # returns one element
> uniq 123, "123.0" # does what LMU does (stringy
> comparison, I think)
That sounds way to complicated and potentially surprising (if the list contains a coderef).
Leon