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

13
LINES

< > BotCompany Repo | #1017025 // combineToDollarVarPattern

JavaX fragment (include)

sS combineToDollarVarPattern(S a, S b) {
  L<S> tok1 = codeTokens(dropPunctuation(javaTok(a)));
  L<S> tok2 = codeTokens(dropPunctuation(javaTok(b)));
  if (l(tok1) != l(tok2)) null;
  new L<S> out;
  Iterator<S> varNames = allWordsOfAlphabet(lowerCaseAlphabet());
  varNames.next(); // Skip "$"
  for i over tok1: {
    S t = tok1.get(i);
    out.add(eq(t, tok2.get(i)) ? t : "$" + varNames.next());
  }
  ret joinWithSpace(out);
}

Author comment

Began life as a copy of #1017024

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: #1017025
Snippet name: combineToDollarVarPattern
Eternal ID of this version: #1017025/2
Text MD5: ede67b1c802bf287dd40166cbc9868a0
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-07-10 20:55:51
Source code size: 444 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 267 / 301
Version history: 1 change(s)
Referenced in: [show references]