Word description Creates a goal which uses the values of obtained logic variables. It can be used to add new rules to or drop rules from the database while a query is running.
The argument quot must not return any values, the created goal always return t.
invoke is intended to be used in a quotation. If there is a quotation in the definition of rule, logic uses the internal definition of the goal obtained by calling it.
Examples In this example, the calculated values are memorized to eliminate recalculation.
USING: logic kernel lists assocs locals math prettyprint ;
IN: scratchpad
LOGIC-PRED: fibo
LOGIC-VARS: F F1 F2 N N1 N2 ;
{ fibo 1 1 } fact
{ fibo 2 1 } fact
{ fibo N F } {
{ (>) N 2 }
[ [ N of 1 - ] N1 is ] { fibo N1 F1 }
[ [ N of 2 - ] N2 is ] { fibo N2 F2 }
[ [ [ F1 of ] [ F2 of ] bi + ] F is ]
[
[
[ N of ] [ F of ] bi
[let :> ( nv fv ) { fibo nv fv } !! rule* ]
] invoke ]
} rule
{ fibo 10 F } query . { H{ { F 55 } } }