!7 sS input = "plants grow"; srecord SomethingWhichIs(S type) {} srecord WordSequence(new L l) { *(O... elements) { addAll(l, elements); } } p { //ai_independentSmartBot(); WordSequence pat = WordSequence( SomethingWhichIs("a noun"), SomethingWhichIs("a verb")); printStruct(pat); WordSequence real = WordSequence("plants", "grow"); printStruct(real); new Map map; if (matchWordSequence(pat, real, map)) printStruct(map); else print("no match"); } static bool matchWordSequence(WordSequence pat, WordSequence real, Map map) { int n = l(pat.l); if (n != l(real.l)) false; new Map map; for i to n: if (!matchElement(pat.l.get(i), real.l.get(i), map)) false; true; } static bool matchElement(O pat, O real, Map map) { if (eq(pat, real)) true; if (pat << SomethingWhichIs && real instanceof S) ret ai_is((S) real, pat/SomethingWhichIs.type); false; }