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

9
LINES

< > BotCompany Repo | #1017007 // generalDefinitions_add

JavaX fragment (include)

static Pair<Bool, S> generalDefinitions_add(S word, S def) {
  if (empty(word) || empty(def)) ret pair(false, "Empty");
  
  if (mapPairB(f dropGlobalID, mechMultiMapPairsCI(generalDefinitions_listName()).get(word)).contains(pair(word, def)))
    ret pair(false, "Definition already there!");
    
  addToMechMap(generalDefinitions_listName(), litmap(word, appendGlobalID(def)));
  ret pair(true, print("Definition added: " + word + " = " + def));
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1017007
Snippet name: generalDefinitions_add
Eternal ID of this version: #1017007/3
Text MD5: 26957d6a98cfdc4a86951ed093a0671b
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-07-11 17:20:15
Source code size: 457 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 442 / 461
Version history: 2 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1017008 - generalDefinitions_addOrRemove
#1017011 - generalDefinitions_remove
#1017072 - generalDefinitions_addMultiple