Did you know ... | Search Documentation: |
![]() | Pack units -- prolog/units/search.pl |
The relationship established is that `Expr1*Factor1 = Expr2*Factor2 = CommonExpr`.
This predicate is tabled to memoize its results. It employs an iterative deepening approach to search for the closest common ancestor of Expr1 and Expr2. The search expands definitions (guided by the ChildParentGoal predicate, e.g., for unit parents or quantity parents) to establish this commonality.
Goal is expected to take an additional argument, DepthLimit-Flag
where
DepthLimit is the maximum search depth and Flag is a term n(Status)
.
Goal should set (with nb_set/2) Status to depth_limit_exceeded
if it fails due to reaching DepthLimit.
In this case, Goal is called again with DepthLimit + 1
.
If Goal, this predicate fails.
Note: We don't use call_with_depth_limit/2 because the use of exception to signal that the depth limit is reached will cut existing choice points which should be explored. Moreover, Goal is free to count depth level freely.