(* Baseline: word-frequency map over a list using Map.Make + List.fold_left *)
module StrOrd = struct let compare a b = compare a b end ;;
module StrMap = Map.Make(StrOrd) ;;

let inc_count m word =
  match StrMap.find_opt word m with
  | None -> StrMap.add word 1 m
  | Some n -> StrMap.add word (n + 1) m
;;

let count words = List.fold_left inc_count StrMap.empty words ;;

let m = count ["the"; "fox"; "the"; "dog"; "the"; "fox"] ;;
StrMap.find "the" m
