Skip to content

Instantly share code, notes, and snippets.

@cljoly
Created November 11, 2015 13:12
Show Gist options
  • Save cljoly/9838acf31373ac048b5b to your computer and use it in GitHub Desktop.
Save cljoly/9838acf31373ac048b5b to your computer and use it in GitHub Desktop.
let i = Reader.open_file "each.pi";;
let o = Writer.open_file "each.pi.out";;
o >>= (fun o -> i >>= (fun i -> Reader.read_one_chunk_at_a_time i ~handle_chunk:(fun
str ~pos ~len ->
printf "Pos: %i, Len: %i" pos len;
Bigstring.to_string str
|> String.filter ~f:(function '\n' | '\r' | ' ' -> false | _ -> true)
|> Bigstring.of_string
|> Writer.write_bigstring o;
return `Continue)));;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment