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

8
LINES

< > BotCompany Repo | #1023732 // falsesFollowedByTrues_changeIndex_assertNotNull

JavaX fragment (include)

static int falsesFollowedByTrues_changeIndex_assertNotNull(L<Bool> l) {
  int i = 0, n = l(l);
  while (i < n && isFalse(l.get(i))) ++i;
  for (int j = i; j < n; j++)
    if (!isTrue(l.get(i)))
      fail("Not a false/true list: " + l);
  ret i;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1023732
Snippet name: falsesFollowedByTrues_changeIndex_assertNotNull
Eternal ID of this version: #1023732/2
Text MD5: b82c9440544ed74348fe7804800adf97
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-07-07 18:47:17
Source code size: 254 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 233 / 275
Version history: 1 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)