!747 m { static new L entries; p { readLocally("entries"); print(entries.size() + " entries in cache. Not consolidated."); makeAndroid("Snippet Cache Bot."); } static synchronized void consolidate() { new Map byID; for (S e : entries) { new Matches m; if (!find3("snippet *", e, m)) print("Dropping weird entry: " + quote(e)); S id = formatSnippetID(unquote(m.m[0])); byID.put(id, e); } entries = new ArrayList(byID.values()); saveLocally("entries"); } static synchronized S answer(S s) { new Matches m; // new information to store if (match3("meta * - just got it from the web. snippet * now has md5 * and title *.", s, m)) { print("New entry: " + structure(m.m)); entries.add(s); saveLocally("entries"); return "OK, stored."; } // other commands if (match3("please consolidate", s, m)) { consolidate(); return "OK, consolidated to " + entries.size() + " entries."; } return null; } }