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

15
LINES

< > BotCompany Repo | #1022294 // iterateOverListSendingPercentage

JavaX fragment (include)

// onPercentage: voidfunc(Number)
static <A> ItIt<A> iterateOverListSendingPercentage(O onPercentage, L<A> l) {
  ret iff(new O {
    int n = l(l), i = 0, lastPercent = 0;
    
    public O get() {
      if (i >= n) ret endMarker();
      O o = l.get(i++);
      int percent = intPercentRatio(i, n);
      if (percent > lastPercent)
        pcallF(onPercentage, lastPercent = percent);
      ret o;
    }
  });
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1022294
Snippet name: iterateOverListSendingPercentage
Eternal ID of this version: #1022294/3
Text MD5: 44bdab2b1aca39c953946557828a74c6
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-12 20:43:41
Source code size: 426 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 233 / 268
Version history: 2 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)