NextPrevUpTopContentsIndex

findall

Function
Summary

Return all matches of a backward chaining goal.

Signature

findall pattern-to-instantiate goal-to-prove => list

Arguments

pattern-to-instantiate

A list or symbol.

goal-to-prove

Any backward chaining goal.

Values

list

A list

Description

The backward chaining inference engine is started to look for all sets of bindings which satisfy goal-to-prove . For each of those bindings, pattern-to-instantiate is instantiated and collected to return a list. The value is nil if nothing goal-to-prove cannot be satisfied.

Any subgoals that match the object base will only find objects from the current inferencing state.

Examples
(findall '(?x is in (1 2 3)) '(member ?x (1 2 3)))

returns

((1 IS IN (1 2 3))
 (2 IS IN (1 2 3))
 (3 IS IN (1 2 3)))
(findall '(?truck is a truck) '(truck ?truck))

returns

((#<TRUCK TRUCK1> IS A TRUCK)
 (#<TRUCK TRUCK2> IS A TRUCK))
See also

any


KnowledgeWorks and Prolog User Guide (Windows version) - 29 Feb 2008

NextPrevUpTopContentsIndex