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

24
LINES

< > BotCompany Repo | #1014197 // mechMapCI - mech list as case-insensitive map

JavaX fragment (include)

1  
// name -> (name, parsed map)
2  
static Map<S, Pair<S, SS>> mechMapCI_cache = synchroMap();
3  
4  
please include function parseDoubleLeftArrowMapCI_tlft.
5  
6  
static SS mechMapCI(S listName) {
7  
  Pair<S, SS> p = mechMapCI_cache.get(listName);
8  
  S text = mechList_raw(listName);
9  
  if (p != null && eq(p.a, text)) ret p.b;
10  
  S parsing = first(mechList_opt(listName + " | Parsing"));
11  
  SS map;
12  
  if (parsing == null)
13  
    map = parseDoubleArrowMapCI(tlft(text));
14  
  else
15  
    ifdef FancyMechParsing
16  
      map = asCIMap((SS) callAndMake(parsing, text));
17  
    endifdef
18  
    ifndef FancyMechParsing
19  
      map = asCIMap((SS) callMC(parsing, text));
20  
    endifndef
21  
  p = pair(text, map);
22  
  mechMapCI_cache.put(listName, p);
23  
  ret p.b;
24  
}

Author comment

Began life as a copy of #1014191

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: #1014197
Snippet name: mechMapCI - mech list as case-insensitive map
Eternal ID of this version: #1014197/11
Text MD5: 0fca4d7ec42328e4ca6e6b8d3b7c773c
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-10-31 11:58:55
Source code size: 732 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 493 / 598
Version history: 10 change(s)
Referenced in: [show references]