Return all matches of a backward chaining goal.
findall pattern-to-instantiate goal-to-prove => list
A list or symbol.
Any backward chaining goal.
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.
(findall '(?x is in (1 2 3)) '(member ?x (1 2 3)))
((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))
((#<TRUCK TRUCK1> IS A TRUCK)
(#<TRUCK TRUCK2> IS A TRUCK))
KnowledgeWorks and Prolog User Guide (Macintosh version) - 24 Mar 2017