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

13
LINES

< > BotCompany Repo | #1027914 // allSubsetsOfSize_iterator [OK]

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

Libraryless. Click here for Pure Java version (2888L/18K).

static <A> ItIt<L<A>> allSubsetsOfSize_iterator(int m, Cl<A> objects) {
  L<A> list = asList(objects);
  int n = l(list);
  ret mapI(allSpreads(n-m, m+1), spread -> {
    L<A> out = emptyList(m);
    int i = -1;
    for j to m: {
      i += spread.get(j)+1;
      out.add(list.get(i));
    }
    ret out;
  });
}

Author comment

Began life as a copy of #1010465

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1027914
Snippet name: allSubsetsOfSize_iterator [OK]
Eternal ID of this version: #1027914/7
Text MD5: 1291c8a19c134f965bb4d0d9955290f7
Transpilation MD5: 522d2b04086787d4fd0c4909e928b45e
Author: stefan
Category: javax / maths
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-04-21 10:32:54
Source code size: 324 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 333 / 454
Version history: 6 change(s)
Referenced in: [show references]