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

20
LINES

< > BotCompany Repo | #1017011 // generalDefinitions_remove

JavaX fragment (include)

static Pair<Bool, S> generalDefinitions_remove(S word, S def) {
  if (empty(word) || empty(def)) ret pair(false, "Empty");
  
  L<S> defs = mechMultiMapCI(generalDefinitions_listName()).get(word);
  defs = definitions_dropInvalidated(defs);
  
  new SS globalIDs;
  for (S found : defs)
    if (eqic(dropGlobalID(found), def))
      globalIDs.put(getAppendedGlobalID(found), dropGlobalID(found));
      
  if (empty(globalIDs))
    ret pair(false, "Definition not there");
    
  for (S id, text : globalIDs) {
    addToMechMap(generalDefinitions_listName(),
      litmap(word, appendGlobalID("[invalidate " + id + ": " + text + "]")));
  }
  ret pair(true, "Definition removed " + n2(globalIDs, "time") + ": " + word + " = " + def);
}

Author comment

Began life as a copy of #1017007

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: #1017011
Snippet name: generalDefinitions_remove
Eternal ID of this version: #1017011/6
Text MD5: 4112d817e98582f66798badf814e2153
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-10 16:43:07
Source code size: 754 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 367 / 401
Version history: 5 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)