Skip to content

Instantly share code, notes, and snippets.

@l1x
Last active August 29, 2015 14:21
Show Gist options
  • Save l1x/f679b38a4486a6bfe8db to your computer and use it in GitHub Desktop.
Save l1x/f679b38a4486a6bfe8db to your computer and use it in GitHub Desktop.
let one_dot_words (~string:str string) (~character:chr char) =
let rec one_dot_words_aux (str : string) (chr : char) (pos : int) (acc : string list) : string list =
let max = Bytes.length str in
let tmp = Bytes.copy str in
if pos = max then
acc
else
one_dot_words_aux str chr (pos + 1) ((Bytes.set tmp pos chr;tmp) :: acc ) in
one_dot_words_aux str chr 0 []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment