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

11
LINES

< > BotCompany Repo | #1023507 // indicesOfTokenPredicateSequence

JavaX fragment (include)

1  
// predicates: L<F1<S, Bool>>
2  
static L<Int> indicesOfTokenPredicateSequence(LS tok, L predicates) {
3  
  int n = l(predicates), nn = l(tok)-(n-1)*2;
4  
  new L<Int> out;
5  
  search: for (int i = 1; i < nn; i += 2) {
6  
    for j to n:
7  
      if (!isTrue(callF(predicates.get(j), tok.get(i+j*2)))) continue search;
8  
    out.add(i);
9  
  }
10  
  ret out;
11  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1023507
Snippet name: indicesOfTokenPredicateSequence
Eternal ID of this version: #1023507/3
Text MD5: 90c1227ed00d684f15b43be1ca76e85e
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-06-26 14:17:21
Source code size: 344 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 247 / 277
Version history: 2 change(s)
Referenced in: [show references]