// rulesMechListName = "" => default rules & facts static Steppable nlLogic_processInputOrFact_steppable(S input, bool inputAsFact, S rulesMechListName, Collector out) { ret nlLogic_processInputOrFact_steppable(input, inputAsFact, eq(rulesMechListName, "") ? ai_activeRulesAndFacts() : pair(ai_rulesFromMechLists(tok_splitAtComma(rulesMechListName)), emptyList(S)), out); } static new ThreadLocal nlLogic_processInputOrFact_steppable_allowUnsafeEvals; static Steppable nlLogic_processInputOrFact_steppable(S input, bool inputAsFact, Pair, LS> rulesAndFacts, final Collector out) { new NLLogicChecker_v3 c; if (!inputAsFact) c.input = input; c.facts = reversed(rulesAndFacts.b); if (inputAsFact) c.facts = concatLists(ll(input), c.facts); c.rules = reversed(rulesAndFacts.a); // latest rules first! if (!inputAsFact) c.rules = [IfThen r : c.rules | ai_ruleAccessesInput(r)]; c.allowUnsafeEvals = isTrue(nlLogic_processInputOrFact_steppable_allowUnsafeEvals!); print("Have " + n2(rulesAndFacts.a, "rule")); c.useIterate = true; //c.staticVerbose = true; ret nlLogic_fillBattleSpace_steppable(c, new Collector() { bool add(RuleWithParams r) { ret false with out.add(nlLogic_executedRuleFromRuleWithParams(r)); } }, false); }