!752 concepts. concept Definition { S name; // what is defined S text; // definition text O source; // where definition comes from (optional) O caveat; // an optional restriction of the definition, like "maybe" or "allegedly" or "rarely" or smth. *() {} *(S *name, S *text) { change(); } } p { loadAndAutoSaveConcepts(); serveHttp(7654); makeBot("Wiki."); } synchronized answer { if "def * *" { S name = m.unq(0); S text = m.unq(1); new Definition(name, text); int count = countConcepts(Definition.class, "name", name); ret "Definition saved! Now have " + n(count, "definition") + " for " + quote(name) + "."; } } synchronized html { uri = dropPrefix("/", uri); if (startsWith(uri, "!")) { S name = substring(uri, 1); L l = findConceptsWhere(Definition.class, "name", name); if (empty(l)) ret fixHTML("No definition found for " + quote(htmlencode(name))); else ret fixHTML(h1(htmlencode(name)) + ul(map(l, func(Definition d) { htmlencode(d.text) }))); } final MultiSet ms = collectMultiSet(list(Definition.class), "name"); L names = sorted(ms.keySet()); ret fixHTML( h1("A. I. Wiki!") + p("Yo I got definitions for:") + ul(map(names, func(S name) { ahref("/!" + urlencode(name), htmlencode(name)) + bracketedCount(ms.get(name)) }))); }