static S nlMakeUnusedVar(S text) { L<S> tok = nlTok(text); new TreeSet<S> usedVars; for (int i = 1; i < l(tok); i += 2) { S t = tok.get(i); if (t.startsWith("$") && l(t) > 1) usedVars.add(t); } for (int i = 0; i < 26; i++) { S var = "$" + (char) (((int) 'a') + i); if (!usedVars.contains(var)) ret var; } throw fail("Help help help too many variables!"); }
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: | 641 / 600 |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1028810 - firstUnusedCountingDollarVar #3000382 - Answer for ferdie (>> t = 1, f = 0) #3000383 - Answer for funkoverflow (>> t=1, f=0 okay) |