Libraryless. Click here for Pure Java version (1573L/11K/35K).
!752 p { makeBot("Add Bot."); } static S answer(S s) { L<S> tok = javaTok(s); int i; BigInteger result = null; for (S op : litlist("+", "-", "*", "/", "^")) { while ((i = matchMetaNoStar(tok, "<number>", op, "<number>")) >= 0) { BigInteger a = new BigInteger(tok.get(i)), b = new BigInteger(tok.get(i+4)); result = mathOp(op, a, b); clearAllTokens(tok.subList(i, i+5)); tok.set(i, "" + result); tok = javaTok(tok); } } if (result != null) ret "" + result; ret null; }
Began life as a copy of #1001943
download show line numbers debug dex old transpilations
Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, jtubtzbbkimh, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, teubizvjbppd, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1001945 |
Snippet name: | Add/Minus/Mul/Div/Pot Bot (with wrong precedence ^^) |
Eternal ID of this version: | #1001945/1 |
Text MD5: | 799e7112266745cf9f9cd7d2a9592ed4 |
Transpilation MD5: | 9121bc81fb19940e4418d6c186dd52e9 |
Author: | stefan |
Category: | |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-12-10 00:29:29 |
Source code size: | 546 bytes / 22 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 863 / 2547 |
Referenced in: | [show references] |