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

20
LINES

< > BotCompany Repo | #1001943 // Add Bot

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (1625L/11K/36K).

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  
  Long result = null;
11  
  while ((i = matchMeta(tok, "<number>", "+", "<number>")) >= 0) {
12  
    long a = parseLong(tok.get(i)), b = parseLong(tok.get(i+4));
13  
    result = a+b;
14  
    clearAllTokens(tok.subList(i, i+5));
15  
    tok.set(i, "" + result);
16  
    tok = javaTok(tok);
17  
  }
18  
  if (result != null) ret "" + result;
19  
  ret null;
20  
}

Author comment

Began life as a copy of #1001942

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, teubizvjbppd, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1001943
Snippet name: Add Bot
Eternal ID of this version: #1001943/1
Text MD5: b8a939a0dad33d9eafb6b679f777d7a4
Transpilation MD5: 50c919ce6b334e07a4b0bac09be22dc0
Author: stefan
Category:
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-12-09 01:07:08
Source code size: 436 bytes / 20 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 625 / 626
Referenced in: [show references]