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

23
LINES

< > BotCompany Repo | #1018117 // ai_dropTrailingPhrases_repeat

JavaX fragment (include)

static ItIt<S> ai_dropTrailingPhrases_repeat(S s, Collection<S> phrases) {
  final Set<S> set = asCISet(phrases);
  
  final new HashSet<S> seen;
  
  // Make pool of iterators
  final L<Iterator<S>> pool = ll_linkedList((Iterator<S>) ai_dropTrailingPhrases(s, set));
  ret iteratorFromFunction(func -> S {
    while ping (!empty(pool)) {
      Iterator<S> it = first(pool);
      if (!it.hasNext()) continue with removeFirst(pool);
      
      // Get entry and check if seen already
      S entry = it.next();
      if (!seen.add(entry)) continue;

      // found new entry - return and schedule for further analysis
      pool.add(ai_dropTrailingPhrases(entry, set));
      ret entry;
    }
    null;
  });
}

Author comment

Began life as a copy of #1018115

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1018117
Snippet name: ai_dropTrailingPhrases_repeat
Eternal ID of this version: #1018117/4
Text MD5: 3e85e29951e91e66619a0975c211a9fc
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-09-02 14:24:34
Source code size: 733 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 335 / 369
Version history: 3 change(s)
Referenced in: [show references]