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)

static L<IntRange> findCodeTokenNonStreaks(L l, O pred) {
  new L<IntRange> out;
  int i = 1, n = l(l);
  while (i < n) {
    int j = i;
    while (j < n && !isTrue(callF(pred, l.get(j)))) j += 2;
    if (j > i)
      out.add(intRange(i, j-1));
    i = j+2;
  }
  ret out;
}

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: 346 / 383
Version history: 2 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1018231 - findNCNStreaks