XSB delays literals for non-LRD-stratified programs and later simplifies them away. But how can the programmer determine when all simplification has been done? One method is to use local evaluation, discussed below in Section 5.4.1. A second method is to make a top-level call for a predicate, p as follows:
?- p,fail ; p.when the second p in this query is called, all simplification on p will have been performed. However, this query will succeed if p is true or undefined.
How would you modify wfs_call(?Tpred,?Val) so that it properly handled cases in which Tpred is non-ground.