aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xchallenge-095/stuart-little/raku/ch-1.p66
-rwxr-xr-xchallenge-095/stuart-little/raku/ch-2.p621
2 files changed, 27 insertions, 0 deletions
diff --git a/challenge-095/stuart-little/raku/ch-1.p6 b/challenge-095/stuart-little/raku/ch-1.p6
new file mode 100755
index 0000000000..b4d820de49
--- /dev/null
+++ b/challenge-095/stuart-little/raku/ch-1.p6
@@ -0,0 +1,6 @@
+#!/usr/bin/env perl6
+use v6;
+
+# run <script> <number>
+
+(@*ARGS[0] eq @*ARGS[0].flip).Int.say
diff --git a/challenge-095/stuart-little/raku/ch-2.p6 b/challenge-095/stuart-little/raku/ch-2.p6
new file mode 100755
index 0000000000..e88c26c01a
--- /dev/null
+++ b/challenge-095/stuart-little/raku/ch-2.p6
@@ -0,0 +1,21 @@
+#!/usr/bin/env perl6
+use v6;
+
+# run <script>
+
+sub stack_min (@stack,$mn) {
+ (! @stack) && return $mn;
+ my $popped=@stack.pop;
+ return (stack_min(@stack,$mn),($mn,$popped).min).min
+}
+
+my @stack;
+
+[2,-1,0,10,4].map({ @stack.push($_) });
+say qq|Current stack: {@stack}|;
+say qq|Popping: {@stack.pop}|;
+say qq|Current stack: {@stack}|;
+say qq|Peeking: {@stack.[*-1]}|;
+say qq|Current stack: {@stack}|;
+say qq|Stack minimum: {stack_min(@stack,Inf)}|;
+say qq|Current stack: {@stack}|;