!7 !include once #1014750 // CSnippet sS inspiration = [[ snippet titles "[OK]" ]]; static new LL facts; // stores code token parses sS reasoning = [[ assert(inspired "snippet titles") assert(inspired "\"[OK]\"") phrase "snippet titles" "the snippet titles" = "snippet titles" phrase "a set of strings" phrase "a quoted string" singular_plural("snippet title", "snippet titles") snippet titles are a list of strings fact_question_answer("X are Y", "what are X?", "Y") assert_answer("what are snippet titles?", "a list of strings") "[OK]" is a quoted string //length of snippet titles is ]]; p-experiment { L program = tlftj(reasoning); pnl(program); print(); for (S s : tlftj(inspiration)) facts.add(parseFact("inspired " + quote(s))); pnlStruct(facts); print(); for (S s : program) { Pair> p = parseFunctionCall(s); if (p != null) { print("Function call: " + sfu(p)); if (eqic(p.a, "assert")) assertFact(getSingleton(p.b)); else print("Unknown function: " + p.a); } else print("Unknown: " + s); } //loadSnippets(); } svoid loadSnippets { loadMainConceptsFrom_readOnly(#1009918); // get snippets print("Have " + countConcepts(CSnippet) + " snippets"); pnl(takeFirst10(collect(list(CSnippet), 'title)); } static L parseFact(S s) { ret map toLowerIfIdentifier(javaTokC(dropPunctuation(s))); } svoid assertFact(S fact) { assertContains(javaTokC(facts)); }