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.159 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.158 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.157 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.156 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.155 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.154 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.153 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.152 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.151 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.150 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.149 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.148 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.147 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.146 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.145 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.144 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.143 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.142 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.141 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.140 tracks/ocaml/exercises/nucleotide-count/example.ml