rule ( head body -- )


Vocabulary
logic

Inputs
headan array representing a goal
bodyan array of goals or a goal


Outputs
None

Word description
Registers the rule to the end of the logic predicate that is in the head. The general form of rule is: Gh { Gb1 Gb2 ... Gbn } rule This means Gh when all goals of Gb1, Gb2, ..., Gbn are met. This Gb1 Gb2 ... Gbn is a conjunction. If the body array contains only one goal definition, you can write it instead of the body array. That is, they are equivalent. Gh { Gb } rule Gh Gb rule

Examples
USING: logic prettyprint ; IN: scratchpad LOGIC-PREDS: mouseo youngo young-mouseo ; SYMBOLS: Jerry Nibbles ; { mouseo Jerry } fact { mouseo Nibbles } fact { youngo Nibbles } fact { young-mouseo X } { { mouseo X } { youngo X } } rule { young-mouseo X } query .
{ H{ { X Nibbles } } }


See also
rule*, rules

Definition