Sha256: 1a2e81fa7590d2dc9e1df31ce9f88c2846432f3bbcef5512d77e52d029ee019b

Contents?: true

Size: 289 Bytes

Versions: 68

Compression:

Stored size: 289 Bytes

Contents

open Core_kernel

module CMap = Char.Map

let count s c =
    let f n c' = if c = c' then n + 1 else n in
    String.fold ~init:0 ~f s

let nucleotide_counts s =
    let f m c = CMap.change m c ~f:(function None -> Some 1 | Some n -> Some (n + 1)) in
    String.fold ~init:CMap.empty ~f s

Version data entries

68 entries across 68 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.179 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.178 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.177 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.176 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.175 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.174 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.173 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.172 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.171 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.170 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.169 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.167 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.166 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.165 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.164 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.163 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.162 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.161 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.160 tracks/ocaml/exercises/nucleotide-count/example.ml