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).

!752

static Map<S, S> shortDefinitions;

p {
  shortDefinitions = new PersistentMap("shortDefinitions");
}

synchronized answer {
  if (!tb()) null;
  
  if "a * is a *" {
    shortDefinitions.put(toLowerCase(m.unq(0)), m.unq(1));
    ret "OK!";
  }
  
  if "a * is not a *" {
    S in = toLowerCase(m.unq(0));
    if (eqic(shortDefinitions.get(in), m.unq(1))) {
      shortDefinitions.remove(in);
      ret "Removed!";
    }
  }

  if "what is a *" {
    S in = toLowerCase(m.unq(0));
    S out = shortDefinitions.get(in);
    if (nempty(out))
      ret format("A * is a *", in, out);
  }
}

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: 707 / 802
Referenced in: [show references]