Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

21
LINES

< > BotCompany Repo | #1018343 // applyNLLogicFacts_v4_iterate_steppable

JavaX fragment (include)

static new ThreadLocal<Bool> applyNLLogicFacts_v4_iterate_steppable_verbose;

static SplittableSteppable applyNLLogicFacts_v4_iterate_steppable(final NLLogicChecker_v2 c, final VF2<IfThen, NLLogicChecker_v2.Matching> onRuleFired, final VF4<IfThen, NLLogicChecker_v2.Matching, L<Exp>, Exp> onRuleFailed, L<IfThen> rules) {
  c.rules = rules;
  final bool verbose = isTrue(applyNLLogicFacts_v4_iterate_steppable_verbose!);
  ret splittableSteppable_forEach(rules, voidfunc(final IfThen rule) { pcall {
    final new NLLogicChecker_v2.Matching m;
    m.verbose = verbose;
    if (verbose)
      print("Checking rule (iterating): " + rule);
    nlLogic_iterate_withOnFail2(c, rule.in, m, new L, r {
      if (verbose) {
        print("Matched " + quote(c.input) + " with rule " + quote(rule));
        printStruct("  ", m.matches);
      }
      callF(onRuleFired, rule, m);
    }, voidfunc(L<Exp> satisfiedConditions, Exp e) {
      callF(onRuleFailed, rule, m, satisfiedConditions, e)
    });
  }});
}

Author comment

Began life as a copy of #1018330

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1018343
Snippet name: applyNLLogicFacts_v4_iterate_steppable
Eternal ID of this version: #1018343/8
Text MD5: dc712ccaa1ab2fd78340ebef95039d3a
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-09-20 06:21:24
Source code size: 1019 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 336 / 397
Version history: 7 change(s)
Referenced in: [show references]