query ( goal-def/defs -- bindings-array/success? ) (original) (raw)

Vocabulary
logic

Inputs

goal-def/defs a goal def or an array of goal defs

Outputs

bindings-array/success? anser

Word description
Inquire about the order of goals. The general form of a query is: { G1 G2 ... Gn } query This G1, G2, ... Gn is a conjunction. When all of them are satisfied, it becomes t. If there is only one goal, you can use its abbreviation. G1 query When you query with logic variable(s), you will get the answer for the logic variable(s). For such queries, an array of hashtables with logic variables as keys is returned.

Examples

USING: logic prettyprint ; IN: scratchpad LOGIC-PREDS: cato mouseo creatureo ; LOGIC-VARS: X Y ; SYMBOLS: Tom Jerry Nibbles ; { cato Tom } fact { mouseo Jerry } fact { mouseo Nibbles } fact { cato Tom } query . { { cato Tom } { cato Jerry } } query . { mouseo X } query .
t f { H{ { X Jerry } } H{ { X Nibbles } } }

See also
nquery

Definition