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

12
LINES

< > BotCompany Repo | #1018225 // findCodeTokenNonStreaks - find IntRanges of code tokens in a CNC list where predicate is false; ranges are C to N

JavaX fragment (include)

1  
static L<IntRange> findCodeTokenNonStreaks(L l, O pred) {
2  
  new L<IntRange> out;
3  
  int i = 1, n = l(l);
4  
  while (i < n) {
5  
    int j = i;
6  
    while (j < n && !isTrue(callF(pred, l.get(j)))) j += 2;
7  
    if (j > i)
8  
      out.add(intRange(i, j-1));
9  
    i = j+2;
10  
  }
11  
  ret out;
12  
}

Author comment

Began life as a copy of #1018224

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1018225
Snippet name: findCodeTokenNonStreaks - find IntRanges of code tokens in a CNC list where predicate is false; ranges are C to N
Eternal ID of this version: #1018225/3
Text MD5: f2903131f40a60b48b49c6b5abd01e9f
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-09-11 13:17:04
Source code size: 285 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 345 / 383
Version history: 2 change(s)
Referenced in: [show references]