diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2020-12-07 21:17:19 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-07 21:17:19 +0000 |
| commit | e04fd2faf611eb52b4042bbbf913e4743db30527 (patch) | |
| tree | b83c2abf3684de3e3b0e46783fb7d88a744e64b5 | |
| parent | c1669089d1740e8183e8ac8b875731741b234861 (diff) | |
| parent | b60693356e3c00112901af37b26f19babfc6fa4d (diff) | |
| download | perlweeklychallenge-club-e04fd2faf611eb52b4042bbbf913e4743db30527.tar.gz perlweeklychallenge-club-e04fd2faf611eb52b4042bbbf913e4743db30527.tar.bz2 perlweeklychallenge-club-e04fd2faf611eb52b4042bbbf913e4743db30527.zip | |
Merge pull request #2937 from Scimon/master
Here we go.
| -rw-r--r-- | challenge-090/simon-proctor/raku/ch-1.raku | 16 | ||||
| -rw-r--r-- | challenge-090/simon-proctor/raku/ch-2.raku | 17 |
2 files changed, 33 insertions, 0 deletions
diff --git a/challenge-090/simon-proctor/raku/ch-1.raku b/challenge-090/simon-proctor/raku/ch-1.raku new file mode 100644 index 0000000000..62d13ce95c --- /dev/null +++ b/challenge-090/simon-proctor/raku/ch-1.raku @@ -0,0 +1,16 @@ +#!/usr/bin/env raku + +use v6; + +my $sequence = "GTAAACCCCTTTTCATTTAGACAGATCGACTCCTTATCCATTCTCAGAGATGTGTTGCTGGTCGCCG"; + +say nucleotide-count( $sequence ); +say complement( $sequence ); + +sub nucleotide-count( $sequence ) { + return $sequence.comb.Bag.pairs.sort( *.value ).reverse.map( -> $p { "{$p.key} : {$p.value}" } ).join("\n"); +} + +sub complement( $sequence ) { + with $sequence { return TR/TAGC/ATCG/; } +} diff --git a/challenge-090/simon-proctor/raku/ch-2.raku b/challenge-090/simon-proctor/raku/ch-2.raku new file mode 100644 index 0000000000..a15b088f50 --- /dev/null +++ b/challenge-090/simon-proctor/raku/ch-2.raku @@ -0,0 +1,17 @@ +#!/usr/bin/env raku + +use v6; + +#| Given two Integers demonstrate Ethiopian Multiplication with them +sub MAIN ( UInt $A is copy, UInt $B is copy ) { + my @parts; + say "Given $A and $B {$A %% 2 ?? '' !! '*'}"; + @parts.push($B) unless $A %% 2; + while ( $A > 1 ) { + $A div= 2; + $B *= 2; + say "Got $A and $B {$A %% 2 ?? '' !! '*'}"; + @parts.push($B) unless $A %% 2; + } + say "Adding {@parts.join(",")} to get {[+] @parts}"; +} |
