Skip to content

Instantly share code, notes, and snippets.

@b4284
Created July 20, 2017 16:27
Show Gist options
  • Select an option

  • Save b4284/4d4e8784fba2575ba310712e46c387a0 to your computer and use it in GitHub Desktop.

Select an option

Save b4284/4d4e8784fba2575ba310712e46c387a0 to your computer and use it in GitHub Desktop.
open Core
let () =
let unit_str = "y\n" and unit_str_len = 2 in
let buf = Buffer.create 0 in
let rec print_endlessly () =
Out_channel.output_buffer stdout buf;
print_endlessly ()
in
let rec grow_buf () =
if Buffer.length buf + unit_str_len < 8192 then
begin
Buffer.add_string buf unit_str;
grow_buf ()
end
in
begin
grow_buf ();
print_endlessly ();
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment