Permalink
Browse files

Use KeySet instead of hash.

  • Loading branch information...
1 parent 0acbcf6 commit da7a1d97d704724325b0a05942672d17466c1be0 GlitchMr committed Sep 25, 2012
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/Text/Abbrev.pm
View
@@ -1,15 +1,15 @@
module Abbrev;
multi sub abbrev (*@words) is export {
- my %seen;
+ my $seen = KeySet.new;
my %result;
for @words {
loop (my $len = .chars; $len > 0; --$len) {
my $abbrev = .substr(0, $len);
- if %seen{$abbrev} {
+ if $seen{$abbrev} {
%result.delete: $abbrev;
}
else {
- %seen{$abbrev} = 1;
+ $seen{$abbrev} = 1;
%result{$abbrev} = $_;
}
}

0 comments on commit da7a1d9

Please sign in to comment.