develooper Front page | perl.perl6.language | Postings from February 2005

Re: Valid hash keys?

Thread Previous | Thread Next
Alex Burr
February 27, 2005 11:56
Re: Valid hash keys?
Message ID:

On Sun, Feb 27, 2005 at 02:20:59AM -0700, Luke Palmer wrote:
> I forgot an important concretity.  Hashes should compare based on the
> generic "equal" operator, which knows how to compare apples and apples,
> and oranges and oranges, and occasionally a red orange to an apple.

Um. Hashes don't really compare, though, do they? Maybe you
just mean a notional equals operator, which isn't really used; but
it seems to me that what hashes acutally implement is more of a 
'canonicalize' operator. Actually, it would be useful sometimes
to be able to give a hash an explicit canonicalizer:

my %msdos_files is canonicalized_by lc;

my %fractions is canonicalized_by gcd;


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About