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

16
LINES

< > BotCompany Repo | #1017024 // combineToNLPattern

JavaX fragment (include)

1  
sS combineToNLPattern(S a, S b) {
2  
  if (a == null || b == null) null;
3  
  L<S> tok1 = codeTokens(dropPunctuation(javaTok(a)));
4  
  L<S> tok2 = codeTokens(dropPunctuation(javaTok(b)));
5  
  if (l(tok1) != l(tok2)) null;
6  
  new L<S> out;
7  
  for i over tok1: {
8  
    S t = tok1.get(i);
9  
    out.add(eqic(t, tok2.get(i)) ? t : "*");
10  
  }
11  
  ret joinWithSpace(out);
12  
}
13  
14  
sS combineToNLPattern(Iterable<S> l) {
15  
  ret foldl_noSeed(func(S a, S b) -> S { combineToNLPattern(a, b) }, l);
16  
}

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: 394 / 431
Version history: 4 change(s)
Referenced in: [show references]