Skip to content

Instantly share code, notes, and snippets.

@bitbckt
Created April 13, 2010 19:32
Parallel invoke HOF in OCaml
let invoke (f : 'a -> 'b) x : unit -> 'b =
let input, output = Unix.pipe() in
match Unix.fork() with
| -1 -> (let v = f x in fun () -> v)
| 0 -> Unix.close input;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment