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

12
LINES

< > BotCompany Repo | #1018234 // findNCNNonStreaks

JavaX fragment (include)

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

Author comment

Began life as a copy of #1018231

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: #1018234
Snippet name: findNCNNonStreaks
Eternal ID of this version: #1018234/1
Text MD5: c2dd7880483ab809c725e339cb9fd0da
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-09-11 17:10:06
Source code size: 302 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 384 / 413
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)