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

24
LINES

< > BotCompany Repo | #1019332 // pcallFParallel

JavaX fragment (include)

1  
static <A> L<A> pcallFParallel(F0<A>... functions) {
2  
  ret pcallFParallel(asList(functions));
3  
}
4  
5  
static <A> L<A> pcallFParallel(L<F0<A>> functions) {
6  
  int n = l(functions);
7  
  L<A> outInner = repNull(n);
8  
  final L<A> out = synchroList(outInner);
9  
  new L<Steppable> steppables;
10  
  for i to n: {
11  
    final F0<A> f = functions.get(i);
12  
    final int _i = i;
13  
    steppables.add(new Steppable {
14  
      public bool step() {
15  
        out.set(_i, pcallF(f));
16  
        false;
17  
      }
18  
    });
19  
  }
20  
  new Flag done;
21  
  new MultiThreadStepper(steppables).onDone(rRaiseFlag(done)).start();
22  
  done.waitUntilUp();
23  
  ret outInner;
24  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 12 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1019332
Snippet name: pcallFParallel
Eternal ID of this version: #1019332/6
Text MD5: 65995c02e948552747af9935884c3bc8
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-11-01 12:36:17
Source code size: 632 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 316 / 351
Version history: 5 change(s)
Referenced in: [show references]