diff options
author | dakkar <dakkar@thenautilus.net> | 2020-03-05 20:24:53 +0000 |
---|---|---|
committer | dakkar <dakkar@thenautilus.net> | 2020-03-05 20:24:53 +0000 |
commit | 8caa68bc451e811fc256862dd6ccf6cfcc747610 (patch) | |
tree | aab3907189d357da5638bc6846a80308733a6cd6 /lib/MaildirIndexer/Index | |
parent | nicer types (diff) | |
download | MaildirIndexer-8caa68bc451e811fc256862dd6ccf6cfcc747610.tar.gz MaildirIndexer-8caa68bc451e811fc256862dd6ccf6cfcc747610.tar.bz2 MaildirIndexer-8caa68bc451e811fc256862dd6ccf6cfcc747610.zip |
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)
Diffstat (limited to 'lib/MaildirIndexer/Index')
-rw-r--r-- | lib/MaildirIndexer/Index/ByAddresses.rakumod | 6 |
1 files 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 ); } |