-
-
Notifications
You must be signed in to change notification settings - Fork 0
solvers async
Eugene Lazutkin edited this page Apr 7, 2026
·
2 revisions
Asynchronous callback-style solver. Use this driver when goal predicates need to await (e.g. I/O-bound rules).
import asyncSolve from 'yopl/solvers/async.js';
asyncSolve(rules, name, args, callback): Promise<void>
Same shape as solve, but the callback may return a Promise and the solver awaits it before backtracking.
import {variable} from 'deep6/env.js'; import assemble from 'deep6/traverse/assemble.js'; import asyncSolve from 'yopl/solvers/async.js'; const rules = {one: () => [{args: [1]}]}; const X = variable('X'); await asyncSolve(rules, 'one', [X], async env => { console.log(assemble(X, env)); // 1 });