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

11
LINES

< > BotCompany Repo | #1023507 // indicesOfTokenPredicateSequence

JavaX fragment (include)

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

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: 248 / 277
Version history: 2 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1023509 - groupTokenPredicateSequence