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.119 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.118 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.117 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.116 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.115 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.114 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.113 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.111 tracks/ocaml/exercises/nucleotide-count/example.ml