elm/exercises/nucleotide-count/NucleotideCount.example

19 lines
402 B
Text
Raw Normal View History

module NucleotideCount (..) where
2016-03-17 01:36:38 +00:00
import String
import List
nucleotideCounts : String -> List ( Char, Int )
nucleotideCounts sequence =
[ (getCount 'A' sequence)
, (getCount 'T' sequence)
, (getCount 'C' sequence)
, (getCount 'G' sequence)
2016-03-17 01:36:38 +00:00
]
getCount : Char -> String -> ( Char, Int )
getCount base sequence =
( base, (List.length (String.split (String.fromChar base) sequence)) - 1 )