From ffc99d05669cd8a6b513366d14b76524fbe1d818 Mon Sep 17 00:00:00 2001 From: Francis Whittle Date: Mon, 9 Sep 2019 08:45:45 +1000 Subject: fjwhittle Challenge 024 solutions --- challenge-024/fjwhittle/perl6/ch-1.p6 | 0 challenge-024/fjwhittle/perl6/ch-2.p6 | 12 ++++++++++++ 2 files changed, 12 insertions(+) create mode 100644 challenge-024/fjwhittle/perl6/ch-1.p6 create mode 100644 challenge-024/fjwhittle/perl6/ch-2.p6 (limited to 'challenge-024') diff --git a/challenge-024/fjwhittle/perl6/ch-1.p6 b/challenge-024/fjwhittle/perl6/ch-1.p6 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/challenge-024/fjwhittle/perl6/ch-2.p6 b/challenge-024/fjwhittle/perl6/ch-2.p6 new file mode 100644 index 0000000000..1b0dc9bb6e --- /dev/null +++ b/challenge-024/fjwhittle/perl6/ch-2.p6 @@ -0,0 +1,12 @@ +unit sub MAIN (*@file); + +my %index; + +for @file.map(*.?IO).grep({.?f && .?r}) -> $file { + %index.push: + $file.comb(/\w+/, :match).hyper.map({ .Str.fc => $($file.path => .pos,) }); +} + +while my $word = prompt 'Find? ' { + %index{$word.fc}ยป.say; +} -- cgit