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

14
LINES

< > BotCompany Repo | #1027154 // philosophyBot1_addSimplificationRule

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

Libraryless. Click here for Pure Java version (8783L/56K).

// e.g. in = "very $x", out = "$x"
svoid philosophyBot1_addSimplificationRule(PhilosophyBot1 bot, S in, S out) {
  Set<PairS> replacements = cast bot.getExtension("simplification rules");
  if (replacements == null) {
    bot.addExtension("simplification rules", replacements = new Set);
    Set<PairS> _replacements = replacements;
    bot.addDeepTransformer(s -> {
      for (PairS p : _replacements)
        try answer simpleRewriteWithDollarVars(p.a, p.b, s);
      null;
    });
  }
  replacements.add(pair(in, out));
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1027154
Snippet name: philosophyBot1_addSimplificationRule
Eternal ID of this version: #1027154/5
Text MD5: ea17d93cb6c5933a9f56986f7ba76da1
Transpilation MD5: 9a4e0740648352dd57b0b321800136db
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-02-22 17:00:53
Source code size: 537 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 182 / 279
Version history: 4 change(s)
Referenced in: [show references]