summary refs log tree commit diff stats
path: root/raku
diff options
context:
space:
mode:
Diffstat (limited to 'raku')
-rw-r--r--raku/rna-transcription/HELP.md32
-rw-r--r--raku/rna-transcription/README.md41
-rw-r--r--raku/rna-transcription/RNA.rakumod5
-rw-r--r--raku/rna-transcription/rna-transcription.rakutest65
4 files changed, 143 insertions, 0 deletions
diff --git a/raku/rna-transcription/HELP.md b/raku/rna-transcription/HELP.md
new file mode 100644
index 0000000..3964a61
--- /dev/null
+++ b/raku/rna-transcription/HELP.md
@@ -0,0 +1,32 @@
+# Help
+
+## Running the tests
+
+You can run the test suite for the exercise by executing the command
+`prove6 .` in the exercise directory.
+
+## Submitting your solution
+
+You can submit your solution using the `exercism submit RNA.rakumod` command.
+This command will upload your solution to the Exercism website and print the solution page's URL.
+
+It's possible to submit an incomplete solution which allows you to:
+
+- See how others have completed the exercise
+- Request help from a mentor
+
+## Need to get help?
+
+If you'd like help solving the exercise, check the following pages:
+
+- The [Raku track's documentation](https://exercism.org/docs/tracks/raku)
+- [Exercism's support channel on gitter](https://gitter.im/exercism/support)
+- The [Frequently Asked Questions](https://exercism.org/docs/using/faqs)
+
+Should those resources not suffice, you could submit your (incomplete) solution to request mentoring.
+
+To get help if you're having trouble, you can use one of the following resources:
+
+- [Raku resources](https://raku.org/resources/)
+- [/r/rakulang](https://www.reddit.com/r/rakulang) is the Raku subreddit.
+- [StackOverflow](http://stackoverflow.com/questions/tagged/raku) can be used to search for your problem and see if it has been answered already. You can also ask and answer questions.
\ No newline at end of file
diff --git a/raku/rna-transcription/README.md b/raku/rna-transcription/README.md
new file mode 100644
index 0000000..154e168
--- /dev/null
+++ b/raku/rna-transcription/README.md
@@ -0,0 +1,41 @@
+# Rna Transcription
+
+Welcome to Rna Transcription on Exercism's Raku Track.
+If you need help running the tests or submitting your code, check out `HELP.md`.
+
+## Instructions
+
+Given a DNA strand, return its RNA complement (per RNA transcription).
+
+Both DNA and RNA strands are a sequence of nucleotides.
+
+The four nucleotides found in DNA are adenine (**A**), cytosine (**C**),
+guanine (**G**) and thymine (**T**).
+
+The four nucleotides found in RNA are adenine (**A**), cytosine (**C**),
+guanine (**G**) and uracil (**U**).
+
+Given a DNA strand, its transcribed RNA strand is formed by replacing
+each nucleotide with its complement:
+
+* `G` -> `C`
+* `C` -> `G`
+* `T` -> `A`
+* `A` -> `U`
+
+## Source
+
+### Created by
+
+- @dnmfarrell
+
+### Contributed to by
+
+- @kotp
+- @kytrinyx
+- @m-dango
+- @yanick
+
+### Based on
+
+Hyperphysics - http://hyperphysics.phy-astr.gsu.edu/hbase/Organic/transcription.html
\ No newline at end of file
diff --git a/raku/rna-transcription/RNA.rakumod b/raku/rna-transcription/RNA.rakumod
new file mode 100644
index 0000000..a694d70
--- /dev/null
+++ b/raku/rna-transcription/RNA.rakumod
@@ -0,0 +1,5 @@
+unit module RNA;
+
+sub to-rna (Str $dna --> Str) is export {
+    $dna.trans(<G C T A> => <C G A U>);
+}
diff --git a/raku/rna-transcription/rna-transcription.rakutest b/raku/rna-transcription/rna-transcription.rakutest
new file mode 100644
index 0000000..a2db9ab
--- /dev/null
+++ b/raku/rna-transcription/rna-transcription.rakutest
@@ -0,0 +1,65 @@
+#!/usr/bin/env raku
+use Test;
+use JSON::Fast;
+use lib $?FILE.IO.dirname;
+use RNA;
+plan 6;
+
+my @test-cases = from-json($=pod[*-1].contents).List;
+for @test-cases -> %case {
+  is to-rna(%case<input><dna>), |%case<expected description>;
+}
+
+=head2 Test Cases
+=begin code
+[
+  {
+    "description": "Empty RNA sequence",
+    "expected": "",
+    "input": {
+      "dna": ""
+    },
+    "property": "toRna"
+  },
+  {
+    "description": "RNA complement of cytosine is guanine",
+    "expected": "G",
+    "input": {
+      "dna": "C"
+    },
+    "property": "toRna"
+  },
+  {
+    "description": "RNA complement of guanine is cytosine",
+    "expected": "C",
+    "input": {
+      "dna": "G"
+    },
+    "property": "toRna"
+  },
+  {
+    "description": "RNA complement of thymine is adenine",
+    "expected": "A",
+    "input": {
+      "dna": "T"
+    },
+    "property": "toRna"
+  },
+  {
+    "description": "RNA complement of adenine is uracil",
+    "expected": "U",
+    "input": {
+      "dna": "A"
+    },
+    "property": "toRna"
+  },
+  {
+    "description": "RNA complement",
+    "expected": "UGCACCAGAAUU",
+    "input": {
+      "dna": "ACGTGGTCTTAA"
+    },
+    "property": "toRna"
+  }
+]
+=end code