Interrupt a call in OCaml
问题 I'd like to interrupt a call if it takes too long to compute, like this try do_something () with Too_long -> something_else () Is it possible to do something like that in OCaml? The function do_something may not be modified. 回答1: In general the only way to interrupt a function is to use a signal, as Basile suggested. Unfortunately the control flow will be transferred to a signal handler, so that you will be unable to return a value that you like. To get a more fine-grained control, you can