aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2021-01-12 00:49:46 +0000
committerGitHub <noreply@github.com>2021-01-12 00:49:46 +0000
commite93d5401e42df263203c5259f75c08ae7f6267c8 (patch)
treeaf3abeffca6b163d010ae31de4060e187dbbc088
parent7c3e41c9e86412c3d2e5c10ca32a4e63693ca677 (diff)
parent03e0357b648a10d56954a8f4f7b5773895fa1dc2 (diff)
downloadperlweeklychallenge-club-e93d5401e42df263203c5259f75c08ae7f6267c8.tar.gz
perlweeklychallenge-club-e93d5401e42df263203c5259f75c08ae7f6267c8.tar.bz2
perlweeklychallenge-club-e93d5401e42df263203c5259f75c08ae7f6267c8.zip
Merge pull request #3222 from Scimon/master
This weeks challenge
-rw-r--r--challenge-095/simon-proctor/raku/ch-1.raku9
-rw-r--r--challenge-095/simon-proctor/raku/ch-2.raku20
2 files changed, 29 insertions, 0 deletions
diff --git a/challenge-095/simon-proctor/raku/ch-1.raku b/challenge-095/simon-proctor/raku/ch-1.raku
new file mode 100644
index 0000000000..463db50797
--- /dev/null
+++ b/challenge-095/simon-proctor/raku/ch-1.raku
@@ -0,0 +1,9 @@
+#!/usr/bin/env raku
+
+use v6;
+
+#| Given a Palindromic number print 1
+multi sub MAIN( Int() $N where { $N.Str.flip ~~ $N } ) { say 1 }
+
+#| Given a non Palindromic number print 0
+multi sub MAIN( $ ) { say 0 }
diff --git a/challenge-095/simon-proctor/raku/ch-2.raku b/challenge-095/simon-proctor/raku/ch-2.raku
new file mode 100644
index 0000000000..09f9e1e2ab
--- /dev/null
+++ b/challenge-095/simon-proctor/raku/ch-2.raku
@@ -0,0 +1,20 @@
+#!/usr/bin/env raku
+
+use v6;
+
+role Stack {
+ has @!list handles <push pop min>;
+
+ method top { @!list[*-1]; }
+}
+
+sub MAIN() {
+ my $stack = Stack.new;
+ $stack.push(2);
+ $stack.push(-1);
+ $stack.push(0);
+ say $stack.pop; # print and removes 0
+ say $stack.top; # prints -1
+ $stack.push(0);
+ say $stack.min; # prints -1
+}