compfindg(expression,sentence,factset,ruleset) → expressionlist
The compfindg subroutine takes as arguments an expression (called the aspect), a sentence (called the query), a factset, and a ruleset. It returns as value a generator that can be used to produce incremental answers to the query. Each time the generator is invoked (using the call subroutine), it uses the facts in the factset and the rules in the ruleset to derive an additional instance of the query. If it succeeds, it returns tne corresponding of the aspect; if it fails, it returns [].
Call: definefacts(repository,readdata('p(art,bob) p(bob,cal) p(bob,cam)'))
Exit: true
Call: definerules(library,readdata('g(X,Z) :- p(X,Y) & p(Y,Z)'))
Exit: true
Call: var gen = compfindg('Z',read('g(art,Z)'),repository,library)
Exit: ...
Call: call(gen)
Exit: cal
Call: call(gen)
Exit: cam
Call: call(gen)
Exit: false
Call: call(gen)
Exit: false
Call: var gen = compfinds('Z',read('g(bob,Z)'),repository,library)
Exit: ...
Call: call(gen)
Exit: false
See related subroutines compfindp, compfindx, and compfindg.
|