Created
October 24, 2018 10:34
-
-
Save boddhisattva/63ff0055c989feb6cfcfaee1b26cf247 to your computer and use it in GitHub Desktop.
RNA Transcript exercise v3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule DNA do | |
@nucleotides %{?A => ?U, ?C => ?G, ?G => ?C, ?T => ?A } | |
@doc """ | |
Transcribes a character list representing DNA nucleotides to RNA | |
## Examples | |
iex> DNA.to_rna('ACTG') | |
'UGAC' | |
""" | |
@spec to_rna([char]) :: [char] | |
def to_rna(dna) do | |
Enum.map(dna, &(@nucleotides[&1])) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment