Skip to content

Instantly share code, notes, and snippets.

@xekoukou
Created October 20, 2018 21:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xekoukou/4392e15c7b424c56d6ccf4e9a08f1ba9 to your computer and use it in GitHub Desktop.
Save xekoukou/4392e15c7b424c56d6ccf4e9a08f1ba9 to your computer and use it in GitHub Desktop.
let pack ls =
let buf = Buffer.create (List.length ls) in
let e = Uutf.encoder utf8 (`Buffer buf)
in let rec loop ls = match ls with
| [] -> Buffer.contents buf
| (c :: ls) -> print_string (Buffer.contents buf) ; let _ = Uutf.encode e (`Uchar c) in () ; loop ls
in loop ls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment