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

12
LINES

< > BotCompany Repo | #1023782 // multiCall - call a function with all combinations of Multi(...) arguments

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2097L/13K).

static ItIt mapLike multiCall(O f, O... args) {
  int n = l(args);
  Iterable<O>[] lists = new Iterable[n];
  for i to n: {
    O arg = args[i];
    if (arg cast Multi)
      lists[i] = arg.arguments;
    else
      lists[i] = ll(arg);
  }
  ret mapI(outerProduct_arrays(lists), args2 -> callF(f, args2));
}

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: #1023782
Snippet name: multiCall - call a function with all combinations of Multi(...) arguments
Eternal ID of this version: #1023782/12
Text MD5: b30267365a490a2edfe6db23c74c339c
Transpilation MD5: 2285118d18a0fa2a4f7096e4e2cec482
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-07-09 03:43:57
Source code size: 318 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 224 / 338
Version history: 11 change(s)
Referenced in: [show references]