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

16
LINES

< > BotCompany Repo | #1017024 // combineToNLPattern

JavaX fragment (include)

sS combineToNLPattern(S a, S b) {
  if (a == null || b == null) null;
  L<S> tok1 = codeTokens(dropPunctuation(javaTok(a)));
  L<S> tok2 = codeTokens(dropPunctuation(javaTok(b)));
  if (l(tok1) != l(tok2)) null;
  new L<S> out;
  for i over tok1: {
    S t = tok1.get(i);
    out.add(eqic(t, tok2.get(i)) ? t : "*");
  }
  ret joinWithSpace(out);
}

sS combineToNLPattern(Iterable<S> l) {
  ret foldl_noSeed(func(S a, S b) -> S { combineToNLPattern(a, b) }, l);
}

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: #1017024
Snippet name: combineToNLPattern
Eternal ID of this version: #1017024/5
Text MD5: 97d54cb91960cdcc27ecc61393055e02
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-01-22 16:01:02
Source code size: 478 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 393 / 429
Version history: 4 change(s)
Referenced in: [show references]