summary refs log tree commit diff stats
path: root/raku/anagram/Anagram.rakumod
diff options
context:
space:
mode:
Diffstat (limited to 'raku/anagram/Anagram.rakumod')
-rw-r--r--raku/anagram/Anagram.rakumod8
1 files changed, 8 insertions, 0 deletions
diff --git a/raku/anagram/Anagram.rakumod b/raku/anagram/Anagram.rakumod
new file mode 100644
index 0000000..5f67e65
--- /dev/null
+++ b/raku/anagram/Anagram.rakumod
@@ -0,0 +1,8 @@
+unit module Anagram;
+
+sub match-anagrams (Str :$subject!, :@candidates!) is export {
+    gather for @candidates {
+        next if .fc eq $subject.fc;
+        take $_ if .fc.comb.Bag eqv $subject.fc.comb.Bag;
+    }
+}