File: count_hash.ml

package info (click to toggle)
pcre-ocaml 7.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 324 kB
  • sloc: ml: 1,445; ansic: 631; makefile: 38
file content (6 lines) | stat: -rw-r--r-- 244 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
open Hashtbl

let hash = create 1973
let add_string s = try incr (find hash s) with Not_found -> add hash s (ref 1);;
Pcre.foreach_line (fun line -> List.iter add_string (Pcre.split line));
iter (fun k v -> Printf.printf "%4d\t%s\n" !v k) hash