Luke wrote:

I wondered what uniq's default comparator should be, =:=?

Woah there. ~~ is a good comparator and all, but it's not the right
one here. ~~ compares an object and a pattern to see if they match. That makes it the right choice for when and grep. But we're trying to
remove elements that are *the same*, not elements that *match*.

Ah, I missed Larry's message last week where he mused:

    > :     3 =:= 3; # always true?
    > : ~~; # ditto?
    > I think immutable values could work that way, especially if we
    > want to store only a single representation of each immutable
    > string.

If that's now the behaviour of =:= on non-referential values, then I agree that C<uniq> should compare with the =:= operator.

Of course, that presupposes quite a bit of smarts on the part of the operator.
For example, we'd also need to decide what these evaluate to:

    3 =:= 3.0  # ????

    3 =:= '3'  # ????

They're surely not identical, but you'd probably want C<uniq> to think so.

Or maybe you just have to SWYM and write:

    @uniq_nums = uniq [EMAIL PROTECTED];


    @uniq_strs = uniq [EMAIL PROTECTED];

if you have heterogeneous data.


Reply via email to