Next: ref-sem-sec, Previous: ref-sem-typ, Up: ref-sem [Contents][Index]

As we have seen, the goals in the body of a sentence are linked by the
operator ‘`,`’, which can be interpreted as conjunction (and). The
Prolog language provides a number of other operators, known as
*control structures*, for building complex goals. Apart from
being built-in predicates, these control structures play a special
role in certain language features, namely Grammar Rules
(see ref-gru), and when code is loaded or asserted in the context
of modules (see ref-mod). The set of control structures is
described in this section, and consists of:

`:P`,`:Q`*ISO*prove

`P`and`Q``:P`;`:Q`*ISO*prove

`P`or`Q``+M`:`:P`*ISO*call

`P`in module`M``:P`->`:Q`;`:R`*ISO*if

`P`succeeds, then prove`Q`; if not, then prove`R``:P`->`:Q`*ISO*if

`P`succeeds, then prove`Q`; if not, then fail`!`

*ISO*cut any choices taken in the current procedure

`\+`

`:P`*ISO*goal

`P`is not provable`?X`^`:P`there exists an

`X`such that`P`is provable (used in`setof/3`

and`bagof/3`

)`+Iterators`do`:Body`executes

`Body`iteratively according to`Iterators``if(`

`:P`,`:Q`,`:R`)for each solution of

`P`succeeds, prove`Q`; if none, then prove`R``once(`

`:P`)*ISO*Find the first solution, if any, of goal

`P`.

• ref-sem-ctr-cut | The Cut | |

• ref-sem-ctr-dis | Disjunctions | |

• ref-sem-ctr-ite | If-Then-Else | |

• ref-sem-ctr-naf | Negation as Failure | |

• ref-sem-ctr-dol | Do Loops | |

• ref-sem-ctr-oth | Other Control Structures |

Send feedback on this subject.