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

15
LINES

< > BotCompany Repo | #1002880 // nlMakeUnusedVar

JavaX fragment (include)

1  
static S nlMakeUnusedVar(S text) {
2  
  L<S> tok = nlTok(text);
3  
  new TreeSet<S> usedVars;
4  
  for (int i = 1; i < l(tok); i += 2) {
5  
    S t = tok.get(i);
6  
    if (t.startsWith("$") && l(t) > 1)
7  
      usedVars.add(t);
8  
  }
9  
  for (int i = 0; i < 26; i++) {
10  
    S var = "$" + (char) (((int) 'a') + i);
11  
    if (!usedVars.contains(var))
12  
      ret var;
13  
  }
14  
  throw fail("Help help help too many variables!");
15  
}

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: #1002880
Snippet name: nlMakeUnusedVar
Eternal ID of this version: #1002880/1
Text MD5: 0cffb87d98c4d96e5a1b7f04fc87a2c5
Author: stefan
Category: eleu / nl
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-03-13 20:17:22
Source code size: 412 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 642 / 601
Referenced in: [show references]