Documentation Prolog Predicate Reference concurrent future/3


Make a Future from a Prolog goal.


future( ?term, +callable_term, -future )

future(Template, Goal, Future) makes a future Future that resolves to Template for the first answer of Goal. The goal runs asynchronously in a new thread (note that JavaScript is single-threaded). If goal Goal fails, Future resolves to failure. If goal Goal throws an exception, Future resolves to an exception. The result of a future can be retrieved by await/2.