:ALL-PATHS
, a path fails if any of
its branches fails.
:ALL-PATHS accepts two paths. It first queries path1
. If path1
fails, :ALL-PATHS succeeds by default.
If the first path succeeds, it then evaluates path2
(e.g. tells or asks path2
,
as directed) under every substitution generated by the first query and succeeds iff all of the
branches succeed. If path2
is empty, the command succeeds if the first path
succeeds.
(:ALL-PATHS ((child Fred ?child)) ((age ?child ?age) (:test (:lisp (> ?age 10)))) ) Are all of Fred's children are over 10 years old?
If the first path fails, :ALL-PATHS succeeds by default.
Shown below is a standard (not :ALL-PATHS) Algernon query similar to the one above. Note that it will succeed if any of Fred's children are over 10 years old.
((child Fred ?child) (age ?child ?age) (:test (:LISP (> ?age 10))) )