From e7643ac0399f5457a7b307c244f33ea4d24fa0f8 Mon Sep 17 00:00:00 2001 From: PerlMonk Athanasius Date: Sat, 27 Jul 2019 20:42:25 -0700 Subject: Fixed formatting by converting tabs to spaces Changes to be committed: modified: challenge-018/athanasius/perl6/MyPriorityQueue.pm6 modified: challenge-018/athanasius/perl6/ch-1.p6 modified: challenge-018/athanasius/perl6/ch-2.p6 --- challenge-018/athanasius/perl6/MyPriorityQueue.pm6 | 52 +++++++++++----------- challenge-018/athanasius/perl6/ch-1.p6 | 4 +- challenge-018/athanasius/perl6/ch-2.p6 | 8 ++-- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/challenge-018/athanasius/perl6/MyPriorityQueue.pm6 b/challenge-018/athanasius/perl6/MyPriorityQueue.pm6 index 2fbe576368..abc3f80ed0 100644 --- a/challenge-018/athanasius/perl6/MyPriorityQueue.pm6 +++ b/challenge-018/athanasius/perl6/MyPriorityQueue.pm6 @@ -30,40 +30,40 @@ informations. It should serve the following operations: class MyPriorityQueue { - use Heap; + use Heap; - has Heap $!heap; + has Heap $!heap; - submethod BUILD(Bool :$reverse = False) - { - $!heap = $reverse ?? Heap[-*].new - !! Heap[ *].new; - } + submethod BUILD(Bool :$reverse = False) + { + $!heap = $reverse ?? Heap[-*].new + !! Heap[ *].new; + } - method is_empty(--> Bool) - { - return !?$!heap; - } + method is_empty(--> Bool) + { + return !?$!heap; + } - method insert_with_priority(Int:D $priority, Any:D $element) - { - $!heap.push: { order => $priority, - datum => $element, }; - } + method insert_with_priority(Int:D $priority, Any:D $element) + { + $!heap.push: { order => $priority, + datum => $element, }; + } - method pull_highest_priority_element(--> Any) - { - my Any $element; + method pull_highest_priority_element(--> Any) + { + my Any $element; - unless self.is_empty() - { - my %top = $!heap.pop; + unless self.is_empty() + { + my %top = $!heap.pop; - $element = %top< datum >; - } + $element = %top< datum >; + } - return $element; - } + return $element; + } } ################################################################################ diff --git a/challenge-018/athanasius/perl6/ch-1.p6 b/challenge-018/athanasius/perl6/ch-1.p6 index fbbfdc6c87..e8d06ba552 100644 --- a/challenge-018/athanasius/perl6/ch-1.p6 +++ b/challenge-018/athanasius/perl6/ch-1.p6 @@ -26,8 +26,8 @@ details. sub MAIN ( Str:D $string1, - Str:D $string2, - *@strings3-n + Str:D $string2, + *@strings3-n ) { my @strings = $string1, $string2; diff --git a/challenge-018/athanasius/perl6/ch-2.p6 b/challenge-018/athanasius/perl6/ch-2.p6 index 2737dc4ea6..1823c54075 100644 --- a/challenge-018/athanasius/perl6/ch-2.p6 +++ b/challenge-018/athanasius/perl6/ch-2.p6 @@ -35,7 +35,7 @@ use MyPriorityQueue; sub MAIN() { - say ''; + say ''; # (1) Larger number = higher priority @@ -53,7 +53,7 @@ sub MAIN() $pq.insert_with_priority( 1, 'dog.'); $pq.insert_with_priority( 7, 'fox'); - extract-and-display($pq); + extract-and-display($pq); # (2) Lower number = higher priority @@ -71,14 +71,14 @@ sub MAIN() $pq.insert_with_priority( 4, 'do'); $pq.insert_with_priority(-2, "There's"); - extract-and-display($pq); + extract-and-display($pq); } sub extract-and-display(MyPriorityQueue:D $pq) { my @elements; @elements.push: $pq.pull_highest_priority_element until $pq.is_empty; - + say join(' ', @elements); } -- cgit