Skip to content

Instantly share code, notes, and snippets.

@boddhisattva
Created October 24, 2018 10:34
Show Gist options
  • Save boddhisattva/63ff0055c989feb6cfcfaee1b26cf247 to your computer and use it in GitHub Desktop.
Save boddhisattva/63ff0055c989feb6cfcfaee1b26cf247 to your computer and use it in GitHub Desktop.
RNA Transcript exercise v3
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