1 | static L<IntRange> findNCNStreaks(L l, F1<LS, Bool> 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, subList(l, j-1, j+2)))) j += 2; |
7 | if (j > i) |
8 | out.add(intRange(i, j-1)); |
9 | i = j+2; |
10 | } |
11 | ret out; |
12 | } |
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: | 295 / 342 |
Referenced in: | [show references] |