I’d like to do something that looks like
while (it's been less than N seconds) {
u = computeSomethingComplicated(...)
}
but if N seconds elapse before the computation is complete {
u = someDefaultValue
}
I’m pretty sure I don’t know how to do this in OCaml, which makes it even less likely that I can do it in Reason. BTW, the second clause might be replaced by “evaluate some other expression” rather than “set u to some value”.
The context here is playing a game: when it’s your move, I want you to choose a move within 3 seconds, and if you don’t, I’ll make a default move for you (or perhaps declare the game over and say that you lose).
So if I call your “nextMove” procedure, and you chase way down the game tree, and take 30 seconds to make a decision…that’s bad for you.
Any pointers on how to do this in ReasonML?