Skip to content

iterate

Assumes the next proposition from a named domain iterator.

<iterate iterator="nice_destinations"/>

Attribute and placement

Attribute Meaning
iterator Required name of a top-level iterator.

The item has no children and can appear in a plan, postplan, or conditional branch.

Behavior and usage

Each execution assumes one proposition from the iterator. Use <has_more_items iterator="nice_destinations"/> to test whether values remain; the condition is false when the enumeration has reached its end. A later iteration can begin again at the start of the enumeration.

<plan>
  <iterate iterator="nice_destinations"/>
  <if>
    <in_beliefs_or_commitments predicate="destination" value="paris"/>
    <then>
      <inform insist="true">
        <proposition predicate="info" value="we will see the Eiffel Tower"/>
      </inform>
    </then>
  </if>
  <if>
    <has_more_items iterator="nice_destinations"/>
    <else><signal_action_completion/></else>
  </if>
</plan>

See Iterators and Conditions.