is ( quot: ( env -- value ) dist -- goal )


Vocabulary
logic

Inputs
quota quotation
dista logic predicate


Outputs
goala logic-goal


Word description
Takes a quotation and a logic variable to be unified. Each of the two quotations takes an environment and returns a value. is returns the internal representation of the goal. is 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.

Definition


:: is ( quot: ( env -- value ) dist -- goal )
quot collect-logic-vars dup dist swap member?
[ dist suffix ] unless
:> args quot dist "[ %u %s is ]" sprintf <pred> :> is-pred
is-pred args logic-goal boa :> is-goal V{
{
is-goal
[| env |
env dist env quot ( env -- value ) call-effect
unify
]
}
} is-pred defs<< is-goal ;