hypovalue(expression,dataset,dataset,dataset,ruleset) → expression

The subroutine hypovalue takes as argument a term, two datasets (the add list and the delete list), another dataset, and a ruleset. If tries to compute a value for the specified term using the facts in the add list, the facts in the specified dataset minus the facts in the delete list, and the rules in the specified ruleset. If it succeeds, it returns the resulting value; otherwise, it returns false.

The most common use of hypovalue is to evaluate compound terms involving predefined functions.

Call: hypovalue(read('plus(2,3)'), repository, library) Exit: 5 Call: hypovalue(read('max(plus(2,3),times(2,3))'),[],[],repository, library) Exit: 6 Call: hypovalue(read('stringify(art)'),[],[],repository, library) Exit: "art" Call: hypovalue(read('stringappend("Hello",", ","World")'),[],[],repository, library) Exit: "Hello, World" Call: hypovalue(read('sum([2,3,4])'),[],[],repository, library) Exit: 9 Call: hypovalue(read('map(stringify,[art,bob,cal])'),[],[],repository, library) Exit: ["art","bob","cal"]

If the specified term is a symbol, the symbol is returned as value. When called on a variable, hypovalue always returns false.

Call: hypovalue('23',[],[],repository, library) Exit: 23 Call: hypovalue('art',[],[],repository, library) Exit: art Call: hypovalue('X',[],[],repository, library) Exit: false

If the specified term is compound and the operator is not predefined and does not have a function definition, then it is treated as a constructor. In this case, the constructor is applied to the values of the constituent terms and the result returned as value.

Call: grind(hypovalue(read('f(a,b)'),[],[],repository, library)) Exit: f(a,b) Call: grind(hypovalue(read('f(plus(2,3),times(2,3))'),[],[],repository, library)) Exit: f(5,6)

In the case of compound terms in which the operator is not predefined but has a matching definition, the arguments are evaluated and the definition is applied to the resulting values.

Call: definerules(library,readdata('quad(X) := times(X,X)')) Exit: ... Call: grind(hypovalue(read('quad(3)'),[],[],repository, library)) Exit: 9 Call: grind(hypovalue(read('quad(plus(2,3))'),[],[],repository, library)) Exit: 25

Comments and complaints to genesereth@stanford.edu.