elm/exercises/nucleotide-count/NucleotideCount.example

17 lines
334 B
Text
Raw Normal View History

module NucleotideCount (..) where
2016-03-17 01:36:38 +00:00
import String
nucleotideCounts : String -> { a : Int, t : Int, c : Int, g : Int }
nucleotideCounts sequence =
let
getCount n =
String.filter (\c -> c == n) sequence |> String.length
in
{ a = getCount 'A'
, t = getCount 'T'
, c = getCount 'C'
, g = getCount 'G'
}