static ItIt ai_spreadCertainIndices_2_iterator(LS tokPat, LS tokS, L 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; }); }