!7 p-exp { S sentence = "Are atomic bombs powerful devices ?"; S pat = "Are ?"; L tokPat = javaTokWithAngularBracketsC(pat); L tokS = javaTokWithAngularBracketsC(sentence); printStruct(tokPat); printStruct(tokS); int extra = l(tokS)-l(tokPat); L indices = indicesOfAngleBracketVars(tokPat); if (extra <= 0 || empty(indices)) ret with print("Not applicable"); print(indices); new LL out; recurse(extra, l(indices), new L, out); pnl(out); for (L spread : out) { new L tok; int pos = 0, iSpread = 0; for i over tokPat: if (!isAngleBracketed(tokPat.get(i))) tok.add(tokS.get(pos++)); else { int take = spread.get(iSpread++); tok.add(joinWithSpace(subList(tokS, pos, pos+take+1))); pos += take+1; } printStruct(tok); print(joinWithSpace(map curlyBraceOptIfMoreThanOneToken(tok))); } } svoid recurse(int remaining, int n, L collecting, LL out) { if (l(collecting) >= n-1) ret with out.add(listPlus(cloneList(collecting), remaining)); for (int take = 0; take <= remaining; take++) { collecting.add(take); recurse(remaining-take, n, collecting, out); removeLast(collecting); } }