static LL<S> ai_spreadCertainIndices_2(L<S> tokPat, L<S> tokS, L<Int> indices) { int extra = (l(tokS)-l(tokPat))/2; if (extra < 0 || empty(indices)) ret emptyList(); new LL<S> results; for (L<Int> spread : allSpreads(extra, l(indices))) { new L<S> 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; } results.add(tok); } ret results; }
Began life as a copy of #1017287
download show line numbers debug dex old transpilations
Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1021071 |
Snippet name: | ai_spreadCertainIndices_2 - works on CNC, fixing the CNC logic |
Eternal ID of this version: | #1021071/2 |
Text MD5: | d5ef600f3f1114b7354290508aba48dd |
Author: | stefan |
Category: | javax / parsing |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-01-20 15:14:31 |
Source code size: | 632 bytes / 21 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 316 / 352 |
Version history: | 1 change(s) |
Referenced in: | [show references] |