Iterates over a set of bindings.
- A variable that iterates from 1 to the number of bindings.
- A variable that contains the total number of bindings.
- The variable whose bindings are to be counted.
- A non-ground clause containing ?variable.
((:FOR ?i ?n ?leg (legs Spot ?leg))
(:PRINTLN "Leg " ?i " of " ?n " is " ?leg)
Leg 1 of 4 is Spot-leg1
Leg 2 of 4 is Spot-leg2
Leg 3 of 4 is Spot-leg3
Leg 4 of 4 is Spot-leg4
Always succeeds. if clause fails or produces no bindings,
the size variable will be zero and index and
variable will be unbound.
Successive :FOR clauses act like nested For loops in a standard programming language.
Algernon Documentation Central
Algernon home page