How can I return early, as soon as the 1st message gets back and kill all other places having not returned yet? I'm doing a lengthy computation involving a random search, that I would like to speed up.
Apply is used with sync and returns with the result from one of the places.
(sync with multiple arguments (via apply) waits on those arguments and returns with one of them (when there is one that is ready))
Map kills all the places (if they aren't already dead). do-something-with is a stub replace it with something or alternatively just return result as the expression's result from the let block. Haven't tested it, but should work, does this do what you want?
If this is part of a larger program it might be a good idea to setup a custodian to make sure everything is cleaned up when you are done searching for stuff, alternatively you could use exception handlers or dynamic-wind.