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.139 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.138 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.137 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.136 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.135 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.134 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.133 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.132 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.131 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.130 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.129 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.128 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.127 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.126 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.125 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.124 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.123 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.122 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.121 tracks/ocaml/exercises/nucleotide-count/example.ml
trackler-2.2.1.120 tracks/ocaml/exercises/nucleotide-count/example.ml