From 8caa68bc451e811fc256862dd6ccf6cfcc747610 Mon Sep 17 00:00:00 2001 From: dakkar Date: Thu, 5 Mar 2020 20:24:53 +0000 Subject: always decont the arguments to pair this ensures that the pair behaves like a value object (i.e. it works sensibly as a hash key) --- lib/MaildirIndexer/Index/ByAddresses.rakumod | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/MaildirIndexer/Index/ByAddresses.rakumod b/lib/MaildirIndexer/Index/ByAddresses.rakumod index 5836cb8..b2127de 100644 --- a/lib/MaildirIndexer/Index/ByAddresses.rakumod +++ b/lib/MaildirIndexer/Index/ByAddresses.rakumod @@ -28,7 +28,7 @@ submethod account-for(Str @addresses,Str $mailbox,Int $step) { $!count-by-mailbox{$mailbox} += $step; for @addresses -> Str $addr { - my Pair $pair = ( $addr => $mailbox ); + my Pair $pair = ( $addr<> => $mailbox<> ); $!known-addresses{$addr} += $step; my Numeric $count = $!count-by-address-and-mailbox{$pair} += $step; @@ -48,7 +48,7 @@ submethod account-for(Str @addresses,Str $mailbox,Int $step) { my Numeric $p = $!count-by-mailbox{$mailbox} / $!total-count; for $!known-addresses.keys -> Str $addr { - my $addr-p = %!p-address-given-mailbox{$addr => $mailbox} // $NOT-ZERO; + my $addr-p = %!p-address-given-mailbox{$addr<> => $mailbox<>} // $NOT-ZERO; $p *= 1 - $addr-p; } @@ -94,7 +94,7 @@ submethod predict-mailbox-given-addresses(@addresses) { my Numeric $p = %!cached-p-given-mailbox{$mailbox} // $NOT-ZERO; for @addresses -> Str $addr { - my $addr-p = %!p-address-given-mailbox{$addr => $mailbox} // $NOT-ZERO; + my $addr-p = %!p-address-given-mailbox{$addr<> => $mailbox<>} // $NOT-ZERO; $p *= $addr-p / ( 1- $addr-p ); } -- cgit v1.2.3