!include once #1027630 // Msg replace LogicRule with BasicLogicRule. cmodule NewEngineSpike > DynPrintLog { L msgs; bool verbose = true, printNonMatches = true; start-thread { if (empty(msgs)) setField(msgs := mainCruddieLog()); print("Have " + nMessages(msgs)); pnlStruct(takeFirst(2, msgs)); L msgs2 = whereFieldIsTrue fromUser(msgs); new L props; for (Msg msg : takeFirst(5, msgs2)) print(addAndReturn(props, ll(msg, "was understood correctly"))); props.add(print(ll(get(msgs2, 5), "is a wrong recognition"))); LogicRule rule = new( ll("$x", "is a wrong recognition"), ll("$x", "should be corrected")); for (O prop : props) applyLogicRuleToFact(rule, prop); } // define what a variable is bool isVar(O o) { ret o instanceof S && isDollarVar(o/S); } void applyLogicRuleToFact(LogicRule rule, O fact) { new LogicRuleApplier ap; ap.rule = rule; ap.fact = fact; ap.verbose = verbose; ap.printNonMatches = printNonMatches; ap.addRewrittenRHS = lambda2 addRewrittenRHS; ap.tools.isVar = lambda1 isVar; ap.run(); } void addRewrittenRHS(O rhs, O trail) { print("Derived: " + rhs); } }