Libraryless. Click here for Pure Java version (2582L/16K).
static ItIt<LS> ai_spreadCertainIndices_2_iterator(LS tokPat, LS tokS, L<Int> indices) { int extra = (l(tokS)-l(tokPat))/2; if (extra < 0 || empty(indices)) ret emptyItIt(); ret mapI(allSpreads(extra, l(indices)), spread -> { new LS tok; int pos = 0, iSpread = 0, iIndices = 0; for i over tokPat: if (!eq(get(indices, iIndices), i)) tok.add(tokS.get(pos++)); else { ++iIndices; int take = spread.get(iSpread++)*2; tok.add(joinSubList(tokS, pos, pos+take+1)); pos += take+1; } ret tok; }); }
Began life as a copy of #1021071
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1026120 |
Snippet name: | ai_spreadCertainIndices_2_iterator - works on CNC |
Eternal ID of this version: | #1026120/1 |
Text MD5: | 8b37f00fee7976a0ba3bc94092e22db8 |
Transpilation MD5: | 097f7e4967a785c58ea03a881f2f769d |
Author: | stefan |
Category: | javax / parsing |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-11-25 20:13:16 |
Source code size: | 591 bytes / 19 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 205 / 295 |
Referenced in: | [show references] |