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

10
LINES

< > BotCompany Repo | #1012927 // repeatUntilMatches

JavaX fragment (include)

1  
// f : func -> A
2  
// pred: func(A) -> bool
3  
static O repeatUntilMatches(O f, O pred, int timeOut) {
4  
  long time = sysNow();
5  
  while (!timedOut(time, timeOut)) {
6  
    O a = callF(f);
7  
    if (isTrue(callF(pred, a))) ret a;
8  
  }
9  
  null;
10  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1012927
Snippet name: repeatUntilMatches
Eternal ID of this version: #1012927/1
Text MD5: 6d031be39323d9532726347faa917719
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-12-17 23:49:19
Source code size: 240 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 312 / 326
Referenced in: [show references]