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

12
LINES

< > BotCompany Repo | #1018231 // findNCNStreaks

JavaX fragment (include)

static L<IntRange> findNCNStreaks(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 #1018225

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: #1018231
Snippet name: findNCNStreaks
Eternal ID of this version: #1018231/1
Text MD5: f406f33b0cb243b456963bc06d7c9fc2
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:01:09
Source code size: 298 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 294 / 340
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1018234 - findNCNNonStreaks