diff options
| -rw-r--r-- | challenge-095/gugod/raku/ch-2.raku | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/challenge-095/gugod/raku/ch-2.raku b/challenge-095/gugod/raku/ch-2.raku new file mode 100644 index 0000000000..087d432964 --- /dev/null +++ b/challenge-095/gugod/raku/ch-2.raku @@ -0,0 +1,27 @@ +class IntStack { + has Int @!store; + + method push(Int $n) { + @!store.push($n); + } + method pop(--> Int) { + @!store.pop; + } + method top(--> Int) { + @!store.tail; + } + method min(--> Int) { + @!store.min; + } +} + +sub MAIN { + my $stack = IntStack.new; + $stack.push(2); + $stack.push(-1); + $stack.push(0); + $stack.pop; + say $stack.top; + $stack.push(0); + say $stack.min; +} |
