Transpiled version (7190L) is out of date.
sclass AI_CalculationBot > AttractorBot { bool greet = true; run { if (greet) say("I can calculate things for you"); } // CONFIG class CalcAttractor > Attractor { S op; L<Number> arguments; public bool matches(S s) { LS l = regexpFirstGroups("(\\d+)\\s*[x*]\\s*(\\d+)", s); if (l(l) == 2) ret setOp(f mul, l); l = splitAtPlus(s); if (l(l) > 1 && all isInteger(l)) ret setOp(f plus, l); l = splitAtMinus(s); if (l(l) > 1 && all isInteger(l)) ret setOp(f minus, l); false; } bool setOp(S op, LS args) { this.op = op; arguments = map bigint(args); true; } run { say(str(foldl_noSeed(op, arguments))); } } *() { standardAttractors(new CalcAttractor); } }
Began life as a copy of #1023143
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1023147 |
Snippet name: | AI_CalculationBot |
Eternal ID of this version: | #1023147/9 |
Text MD5: | 11157795338814b45bc8895a5c85454d |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-05-15 19:18:45 |
Source code size: | 869 bytes / 44 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 334 / 835 |
Version history: | 8 change(s) |
Referenced in: | [show references] |