Created
April 13, 2010 19:32
-
-
Save bitbckt/364991 to your computer and use it in GitHub Desktop.
Parallel invoke HOF in OCaml
This file contains 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