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

11
LINES

< > BotCompany Repo | #1023792 // outerProduct_faster [OK]

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

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

static <A, B extends Iterable<A>> ItIt<L<A>> outerProduct_faster(L<B> lists) {
  ret mapI fromSimplyLinkedList(outerProduct_faster(toSimplyLinkedList(lists)));
}

static <A, B extends Iterable<A>> ItIt<SimplyLinkedList<A>> outerProduct_faster(SimplyLinkedList<B> lists) {
  if (lists == null) ret singletonIterator(null);
  SimplyLinkedList<B> lists2 = lists.tail;
  ret nestedIterator(lists.head, func(A a) -> Iterator<SimplyLinkedList<A>> {
    mapI(outerProduct_faster(lists2), l -> SimplyLinkedList.cons(a, l))
  });
}

Author comment

Began life as a copy of #1023780

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: #1023792
Snippet name: outerProduct_faster [OK]
Eternal ID of this version: #1023792/5
Text MD5: 1707c53482b94801eb0ae63fb32c008d
Transpilation MD5: 0e71e3873a9fdf4a7c0ae0e22f83a61b
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-07-09 03:28:43
Source code size: 532 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 204 / 304
Version history: 4 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1023796 - outerProduct_arrays - receives an array of Iterables and returns object arrays