From 321825828ac918bad28d0597a8616c6dc9802c3c Mon Sep 17 00:00:00 2001 From: Andinus Date: Wed, 11 Aug 2021 15:26:15 +0530 Subject: Add solved exercises --- raku/anagram/Anagram.rakumod | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 raku/anagram/Anagram.rakumod (limited to 'raku/anagram/Anagram.rakumod') 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; + } +} -- cgit 1.4.1-2-gfad0