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

25
LINES

< > BotCompany Repo | #1025748 // philosophyBot1_factStore

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (7456L/47K).

1  
svoid philosophyBot1_factStore(PhilosophyBot1 bot, IFactStore factStore, O... _) {
2  
  if (factStore == null) ret;
3  
  
4  
  bot.addFacts(factStore.facts());
5  
  
6  
  optPar bool debug;
7  
  bot.addNativePredicate("delete all $x",
8  
    (map) -> {
9  
      S pat = map.get("$x");
10  
      factStore.deleteAll(s -> {
11  
        SS map2 = bot.zipIt(pat, s);
12  
        if (map2 == null) false;
13  
        if (debug) print("Delete match: " + map2);
14  
        true;
15  
      });
16  
      true;
17  
    });
18  
  bot.addNativePredicate("store $x",
19  
    (map) -> {
20  
      S x = map.get("$x");
21  
      if (debug) print("factStore: store " + x);
22  
      factStore.store(x); true;
23  
    });
24  
    
25  
}

Author comment

Began life as a copy of #1025739

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1025748
Snippet name: philosophyBot1_factStore
Eternal ID of this version: #1025748/11
Text MD5: c8684fe078b8d2897bf21ee7d36f2f84
Transpilation MD5: 6876b057f221b835e4406bafe4223466
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-10-20 14:46:59
Source code size: 657 bytes / 25 lines
Pitched / IR pitched: No / No
Views / Downloads: 230 / 384
Version history: 10 change(s)
Referenced in: [show references]