Libraryless. Click here for Pure Java version (8783L/56K).
1 | // e.g. in = "very $x", out = "$x" |
2 | svoid philosophyBot1_addSimplificationRule(PhilosophyBot1 bot, S in, S out) {
|
3 | Set<PairS> replacements = cast bot.getExtension("simplification rules");
|
4 | if (replacements == null) {
|
5 | bot.addExtension("simplification rules", replacements = new Set);
|
6 | Set<PairS> _replacements = replacements; |
7 | bot.addDeepTransformer(s -> {
|
8 | for (PairS p : _replacements) |
9 | try answer simpleRewriteWithDollarVars(p.a, p.b, s); |
10 | null; |
11 | }); |
12 | } |
13 | replacements.add(pair(in, out)); |
14 | } |
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: | 379 / 512 |
| Version history: | 4 change(s) |
| Referenced in: | [show references] |