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

31
LINES

< > BotCompany Repo | #1002991 // TB Definitions Bot

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

Libraryless. Click here for Pure Java version (1810L/12K/39K).

1  
!752
2  
3  
static Map<S, S> shortDefinitions;
4  
5  
p {
6  
  shortDefinitions = new PersistentMap("shortDefinitions");
7  
}
8  
9  
synchronized answer {
10  
  if (!tb()) null;
11  
  
12  
  if "a * is a *" {
13  
    shortDefinitions.put(toLowerCase(m.unq(0)), m.unq(1));
14  
    ret "OK!";
15  
  }
16  
  
17  
  if "a * is not a *" {
18  
    S in = toLowerCase(m.unq(0));
19  
    if (eqic(shortDefinitions.get(in), m.unq(1))) {
20  
      shortDefinitions.remove(in);
21  
      ret "Removed!";
22  
    }
23  
  }
24  
25  
  if "what is a *" {
26  
    S in = toLowerCase(m.unq(0));
27  
    S out = shortDefinitions.get(in);
28  
    if (nempty(out))
29  
      ret format("A * is a *", in, out);
30  
  }
31  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1002991
Snippet name: TB Definitions Bot
Eternal ID of this version: #1002991/1
Text MD5: 4ce1b830b9a8070c9f1185b77bc15a6f
Transpilation MD5: 6a8256ac12f42e803b81991b4da5de21
Author: stefan
Category: eleu / nl
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-04-15 18:00:54
Source code size: 622 bytes / 31 lines
Pitched / IR pitched: No / No
Views / Downloads: 643 / 721
Referenced in: [show references]