!747 !multi-line strings m { !include #1001509 // rules & statements p { rules.add([["$1 is the singular of $2." <=> "$2 is the plural of $1."]]); statements.add("house is the singular of houses."); process(); print(fromLines(statements)); ask([[how many plurals does "house" have?]]); ask([[what are the plurals of "house"?]]); } static void ask(S q) { print("? " + q); new Map map; if (match4("how many plurals does $1 have?", q, map)) print(" => " + getPlurals(map.get("$1")).size()); else if (match4("what are the plurals of $1?", q, map)) print(" => " + structure(getPlurals(map.get("$1")))); else print("dunno."); } static L getPlurals(S x) { S c = "$2 is the plural of " + x; print("[" + c + "]"); MultiMap matches = matchAll(c); ret matches.get("$2"); } }