static LS ai_applyPrefixPair(Pair p, LS x) { if (p == null || !listStartsWithCI(x, p.a)) ret x; ret concatLists(p.b, subList(x, l(p.a))); }