Warning: session_start(): open(/var/lib/php/sessions/sess_2vu3pre2rp900u55iv33e9rohe, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
!include once #1027630 // Msg
replace LogicRule with BasicLogicRule.
cmodule NewEngineSpike > DynPrintLog {
L msgs;
bool verbose = true, printNonMatches = true;
transient new Set facts;
transient AllOnAllWithOperation rulesAndFacts
= new(lambda2 applyLogicRuleToFact);
bool step() { ret rulesAndFacts.step(); }
void addLogicRule(LogicRule rule) {
if (verbose) print("New rule: " + rule);
rulesAndFacts.newA(rule);
}
void addFact(O fact) {
if (!facts.add(fact)) ret;
if (verbose) print("New fact: " + fact);
rulesAndFacts.newB(fact);
}
L factsInOrderOfDefinition() { ret rulesAndFacts.cloneBList(); }
start-thread {
if (empty(msgs))
setField(msgs := mainCruddieLog());
print("Have " + nMessages(msgs));
pnlStruct(takeFirst(2, msgs));
L msgs2 = whereFieldIsTrue fromUser(msgs);
for (Msg msg : takeFirst(5, msgs2))
addFact(ll(msg, Fragment("was understood correctly")));
addFact(ll(get(msgs2, 5), Fragment("is a wrong recognition"))));
addLogicRule(new(
ll("$x", Fragment("is a wrong recognition")),
ll("$x", Fragment("should be corrected"))));
stepAll(lambda0 step);
}
// 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);
}
}