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

14
LINES

< > BotCompany Repo | #1023509 // groupTokenPredicateSequence

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

Libraryless. Click here for Pure Java version (1836L/12K).

// predicates: L<F1<S, Bool>>
// doesn't modify original tok
static LS groupTokenPredicateSequence(LS tok, L predicates) {
  int min = 0;
  bool cloned = false;
  for (int i : indicesOfTokenPredicateSequence(tok, predicates)) {
    continue if i <= min;
    if (!cloned) { cloned = true; tok = cloneList(tok); }
    int j = i+l(predicates)*2-2;
    tok_addCurlyBracketsAroundPart(tok, i, j);
    min = j;
  }
  ret tok;
}

Author comment

Began life as a copy of #1023507

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: #1023509
Snippet name: groupTokenPredicateSequence
Eternal ID of this version: #1023509/6
Text MD5: 832d012b14d9c9e261ad10b0fa6f8862
Transpilation MD5: 36c7ab950c2479212eb23adc7a74e24b
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-27 13:05:24
Source code size: 434 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 190 / 262
Version history: 5 change(s)
Referenced in: [show references]