Libraryless. Click here for Pure Java version (1573L/11K/35K).
| 1 | !752 | 
| 2 | |
| 3 | p {
 | 
| 4 |   makeBot("Add Bot.");
 | 
| 5 | } | 
| 6 | |
| 7 | static S answer(S s) {
 | 
| 8 | L<S> tok = javaTok(s); | 
| 9 | int i; | 
| 10 | BigInteger result = null; | 
| 11 |   for (S op : litlist("+", "-", "*", "/", "^")) {
 | 
| 12 |     while ((i = matchMetaNoStar(tok, "<number>", op, "<number>")) >= 0) {
 | 
| 13 | BigInteger a = new BigInteger(tok.get(i)), b = new BigInteger(tok.get(i+4)); | 
| 14 | result = mathOp(op, a, b); | 
| 15 | clearAllTokens(tok.subList(i, i+5)); | 
| 16 | tok.set(i, "" + result); | 
| 17 | tok = javaTok(tok); | 
| 18 | } | 
| 19 | } | 
| 20 | if (result != null) ret "" + result; | 
| 21 | ret null; | 
| 22 | } | 
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: | 1025 / 2737 | 
| Referenced in: | [show references] |