sS ai_ruleOfThree_solver_1(S db, S input) { new TransformersOnObjects too; too.addAll(lambdaMap ai_parseBasicLogicRule(tlft(db))); too.addAll(Input(input)); // for word appearing in LHS and RHS: turn word into variable too.addTransformer(func(BasicLogicRule r) -> BasicLogicRule { LS words = antiFilter isDollarVar(sharedWords(r.lhs, r.rhs)); SS map = ciMapWithUnusedCountingDollarVars(words, linesLL(r.lhs, r.rhs)); ret mapBasicLogicRule(r, s -> replaceCodeTokensUsingMap(s, map)); }); // match input with rules too.addTransformer(func(BasicLogicRule r) { if (containsDollarVars(r.in)) too.addTransformer(func(Input i) { S s = cast i.a; for (SS map : flexMatchDollarVarsIC_all(r.in, s)) too.add(Input(replaceVars(r.out))); null; }); null; }); too.think(); null; }