<function-to-apply> <expression> [<bound-vars>] [<expression-type>])
A function useful for parsing and analyzing KIF expressions. It walks a KIF expression applying <FUNCTION-TO-APPLY> to each subexpression.
<EXPRESSION> is a KIF sentence or term expression.
<FUNCTION-TO-APPLY> is called wih three arguments:
<EXPRESSION-TYPE>, a KIF expression type like :SENTENCE or :TERM that specifies the syntactic category of the expression. Must be one of the oli::*KIF-expression-types*.
<BOUND-VARS>, the list of currently bound variables, which is updated automatically in lexically enclosed forms inside logic binding constructs. For example,
(exists (?A ?B) <kif-sentence>)
if walk-logical-expression might be called with <expression> bound to <kif-sentence> and <bound-vars> bound to '(?A ?B).
The value returned by <FUNCTION-TO-APPLY> replaces the <EXPRESSION> in the resulting expression tree. Thus, if <FUNCTION-TO-APPLY> alway returns its <EXPRESSION> argument, then the result of a top level call to WALK-LOGICAL-EXPRESSION is equal to the input expression. Each call to <FUNCTION-TO-APPLY> is given the result of recursive calls on subexpressions; in other words, this is a post-fix recursive traversal.
<FUNCTION-TO-APPLY> is usually a generic function with methods which eql specializes on its first argument, the expression type. Usually, the default method will just return its <EXPRESSION> argument, and other methods will be written to pick out specific subexpression types for special processing.