// uses ai_placeholderToList static S simplifyMatchJob1(MatchJob mj) { if (empty(mj.input) || empty(mj.struct)) ret "Solved"; if (eqic(first(mj.input), first(mj.struct))) { matchJob_apply(f dropFirst, mj); ret "Simplified"; } if (eqic(last(mj.input), last(mj.struct))) { matchJob_apply(f dropLast, mj); ret "Simplified"; } // Full match with category if (l(mj.struct) == 1 && isAngleBracketed(first(mj.struct))) { S placeholder = deAngleBracket(first(mj.struct)); S list = ai_placeholderToList().get(placeholder); if (list != null) { bool contained = mechList_containsTokens(list, mj.input); if (contained) { mj.vars.put(placeholder, joinWithSpace(mj.input)); mj.clear(); ret "Simplified"; } } } // Match leading category with first word if (isAngleBracketed(first(mj.struct))) { S placeholder = deAngleBracket(first(mj.struct)); S list = ai_placeholderToList().get(placeholder); if (list != null) { bool contained = mechList_containsTokens(list, ll(first(mj.input))); if (contained) { mj.vars.put(placeholder, first(mj.input)); matchJob_apply(f dropFirst, mj); ret "Simplified"; } } } ret "Nothing to do"; }