in reply to Equivalence classes from equivalence relation and fingerprints
Here's tye's solution. It took some time for me to get it through the chatterbox, even though the idea isn't really complicated. It uses a different interface then I do in the parent post.
my %hash; OBJ: for my $obj ( @objects ) { my $fingerprint = $fingerprint{$obj}; my $class = \@{$hash{$fingerprint}} for( @$class ) { if( same($obj,$_->[0] ) { push @$_, $obj; next OBJ: } } push @$class, [ $obj ] }
|
|---|