:ALL-PATHS

Purpose

Under normal Algernon processing, a path succeeds if any of its branches succeeds. Under :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.


Parameters

path [path]
One or two paths to be evaluated.

Examples

  (:ALL-PATHS ((child Fred   ?child))
              ((age   ?child ?age)
               (:test (:lisp (> ?age 10))))
              )

  Are all of Fred's children are over 10 years old?

Success criteria

Succeeds if all paths listed succeed, or if the first path fails.

Failure criteria

Fails if the first path succeeds and the second path fails.

Notes

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)))
   )

Related commands


Back to...

Algernon commands
Algernon Documentation Central
Algernon home page