Skip to content

Instantly share code, notes, and snippets.

@amonshiz
Last active August 29, 2015 14:12
Show Gist options
  • Save amonshiz/70e8b507fb1086aed11a to your computer and use it in GitHub Desktop.
Save amonshiz/70e8b507fb1086aed11a to your computer and use it in GitHub Desktop.
Solving Counting DNA Nucleotides on Project Rosalind
import Data.Char
import Data.List
data DNANucleotide = A | C | G | T deriving(Show, Eq, Ord, Read)
charToDNANucleotide :: Char -> DNANucleotide
charToDNANucleotide c = read [toUpper c] :: DNANucleotide
mainCountDNANucleotides = do
dna <- getLine
putStrLn $ unwords . map show . map length . group . sort $ map charToDNANucleotide dna
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment