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).

svoid philosophyBot1_factStore(PhilosophyBot1 bot, IFactStore factStore, O... _) {
  if (factStore == null) ret;
  
  bot.addFacts(factStore.facts());
  
  optPar bool debug;
  bot.addNativePredicate("delete all $x",
    (map) -> {
      S pat = map.get("$x");
      factStore.deleteAll(s -> {
        SS map2 = bot.zipIt(pat, s);
        if (map2 == null) false;
        if (debug) print("Delete match: " + map2);
        true;
      });
      true;
    });
  bot.addNativePredicate("store $x",
    (map) -> {
      S x = map.get("$x");
      if (debug) print("factStore: store " + x);
      factStore.store(x); true;
    });
    
}

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