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)

1  
static new ThreadLocal<Bool> applyNLLogicFacts_v4_iterate_steppable_verbose;
2  
3  
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) {
4  
  c.rules = rules;
5  
  final bool verbose = isTrue(applyNLLogicFacts_v4_iterate_steppable_verbose!);
6  
  ret splittableSteppable_forEach(rules, voidfunc(final IfThen rule) { pcall {
7  
    final new NLLogicChecker_v2.Matching m;
8  
    m.verbose = verbose;
9  
    if (verbose)
10  
      print("Checking rule (iterating): " + rule);
11  
    nlLogic_iterate_withOnFail2(c, rule.in, m, new L, r {
12  
      if (verbose) {
13  
        print("Matched " + quote(c.input) + " with rule " + quote(rule));
14  
        printStruct("  ", m.matches);
15  
      }
16  
      callF(onRuleFired, rule, m);
17  
    }, voidfunc(L<Exp> satisfiedConditions, Exp e) {
18  
      callF(onRuleFailed, rule, m, satisfiedConditions, e)
19  
    });
20  
  }});
21  
}

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: 435 / 480
Version history: 7 change(s)
Referenced in: [show references]