From 0fd7c6563118a5ec407335dfae44cb2b0f7c9dba Mon Sep 17 00:00:00 2001 From: Daniel Mita Date: Mon, 6 Jan 2020 17:05:40 +0000 Subject: Add Raku solutions for challenge-042 --- challenge-042/daniel-mita/raku/ch-1.sh | 2 ++ challenge-042/daniel-mita/raku/ch-2.p6 | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100755 challenge-042/daniel-mita/raku/ch-1.sh create mode 100644 challenge-042/daniel-mita/raku/ch-2.p6 (limited to 'challenge-042') diff --git a/challenge-042/daniel-mita/raku/ch-1.sh b/challenge-042/daniel-mita/raku/ch-1.sh new file mode 100755 index 0000000000..987fc3e1cc --- /dev/null +++ b/challenge-042/daniel-mita/raku/ch-1.sh @@ -0,0 +1,2 @@ +#!/bin/sh +raku -e '.base(8).say for ^51' diff --git a/challenge-042/daniel-mita/raku/ch-2.p6 b/challenge-042/daniel-mita/raku/ch-2.p6 new file mode 100644 index 0000000000..036e8b4f9f --- /dev/null +++ b/challenge-042/daniel-mita/raku/ch-2.p6 @@ -0,0 +1,19 @@ +#!/usr/bin/env perl6 + +unit sub MAIN ( + UInt :$parens = 10, +); + +my $count = 0; + +for roll <( )>: (^$parens).pick { + .say; + when '(' { $count++ } + when ')' { die 'close before open' if --$count < 0 } +} + +if $count { + die "$count unclosed"; +} + +'balanced'.say; -- cgit