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)

1  
static ItIt<S> ai_dropTrailingPhrases_repeat(S s, Collection<S> phrases) {
2  
  final Set<S> set = asCISet(phrases);
3  
  
4  
  final new HashSet<S> seen;
5  
  
6  
  // Make pool of iterators
7  
  final L<Iterator<S>> pool = ll_linkedList((Iterator<S>) ai_dropTrailingPhrases(s, set));
8  
  ret iteratorFromFunction(func -> S {
9  
    while ping (!empty(pool)) {
10  
      Iterator<S> it = first(pool);
11  
      if (!it.hasNext()) continue with removeFirst(pool);
12  
      
13  
      // Get entry and check if seen already
14  
      S entry = it.next();
15  
      if (!seen.add(entry)) continue;
16  
17  
      // found new entry - return and schedule for further analysis
18  
      pool.add(ai_dropTrailingPhrases(entry, set));
19  
      ret entry;
20  
    }
21  
    null;
22  
  });
23  
}

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: 269 / 300
Version history: 3 change(s)
Referenced in: [show references]