Responses for exercises in Exercism.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

24 lines
434 B

defmodule RnaTranscription do
@doc """
Transcribes a character list representing DNA nucleotides to RNA
## Examples
iex> RnaTranscription.to_rna('ACTG')
'UGAC'
"""
@spec to_rna([char]) :: [char]
def to_rna(dna) do
Enum.map(dna, &(dna_to_rna(&1)))
end
@spec dna_to_rna(char) :: char
def dna_to_rna(strand) do
case strand do
?A -> ?U
?C -> ?G
?T -> ?A
?G -> ?C
end
end
end