aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPerlMonk Athanasius <PerlMonk.Athanasius@gmail.com>2019-07-27 20:42:25 -0700
committerPerlMonk Athanasius <PerlMonk.Athanasius@gmail.com>2019-07-27 20:42:25 -0700
commite7643ac0399f5457a7b307c244f33ea4d24fa0f8 (patch)
tree057a523725df3122c00adc00c8c4ba384266c7d0
parent3eabb31769e74d6a9b9f1bfa95da4ab0cd5920a5 (diff)
downloadperlweeklychallenge-club-e7643ac0399f5457a7b307c244f33ea4d24fa0f8.tar.gz
perlweeklychallenge-club-e7643ac0399f5457a7b307c244f33ea4d24fa0f8.tar.bz2
perlweeklychallenge-club-e7643ac0399f5457a7b307c244f33ea4d24fa0f8.zip
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
-rw-r--r--challenge-018/athanasius/perl6/MyPriorityQueue.pm652
-rw-r--r--challenge-018/athanasius/perl6/ch-1.p64
-rw-r--r--challenge-018/athanasius/perl6/ch-2.p68
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[-*<order>].new
- !! Heap[ *<order>].new;
- }
+ submethod BUILD(Bool :$reverse = False)
+ {
+ $!heap = $reverse ?? Heap[-*<order>].new
+ !! Heap[ *<order>].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);
}