Created
April 13, 2010 19:32
Parallel invoke HOF in OCaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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