Skip to content

Instantly share code, notes, and snippets.

@AlexDaniel
Created January 29, 2019 13:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlexDaniel/719b855bc2f76ce1a8d2bbd14d0862a8 to your computer and use it in GitHub Desktop.
Save AlexDaniel/719b855bc2f76ce1a8d2bbd14d0862a8 to your computer and use it in GitHub Desktop.
diff --git a/lib/Data/StaticTable.pm6 b/lib/Data/StaticTable.pm6
index df6cdc0..d175dcb 100644
--- a/lib/Data/StaticTable.pm6
+++ b/lib/Data/StaticTable.pm6
@@ -317,12 +317,12 @@ class StaticTable::Query {
X::Data::StaticTable.new("Method grep only accepts one adverb at a time").throw unless one($n, $r, $default, $nr, $nh) == True;
my Data::StaticTable::Position @rownums;
if (%!indexes{$heading}:exists) { #-- Search in the index if it is available. Should be faster.
- my @keysearch = grep {.defined and $matcher}, %!indexes{$heading}.keys;
+ my @keysearch = grep {.defined and $_ ~~ $matcher}, %!indexes{$heading}.keys;
for (@keysearch) -> $k {
@rownums.push(|%!indexes{$heading}{$k});
}
} else {;
- @rownums = 1 <<+>> ( grep {.defined and $matcher}, :k, $!T.column($heading) );
+ @rownums = 1 <<+>> ( grep {.defined and $_ ~~ $matcher}, :k, $!T.column($heading) );
}
if ($n) { # Returning rowlist
return @rownums.sort.list #-- :n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment