Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save agustingianni/2e95a364a62e0332c06c5bd6892bc07c to your computer and use it in GitHub Desktop.
Save agustingianni/2e95a364a62e0332c06c5bd6892bc07c to your computer and use it in GitHub Desktop.
open String
open List
(* Give a string return a dictionary of the words and the amount of times they are used *)
let word_frequency string =
let words = String.split_on_char ' ' string in
words
let _ =
List.iter print_endline (word_frequency "HOLA PEPE")
List.iter print_endline (word_frequency "PIPI PAPA")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment