sclass SimpleFactStore implements IFactStore { L facts = synchroList(); transient bool verbose; transient L onChange = syncList(); sclass Fact extends HasGlobalID { long created = now(); S text; *() {} *(S *text) {} toString { ret text; } } public void store(S fact) { if (!any(facts, f -> eqic(f.text, fact))) { facts.add(new Fact(fact)); pcallFAll(onChange); } } public void deleteAll(IPred filter) { for (Fact f : cloneList(facts)) if (filter.get(f.text)) { if (verbose) print("Deleting fact: " + f); facts.remove(f); pcallFAll(onChange); } } public LS facts() { ret map(facts, f -> f.text); } toString { ret sfu(this); } void onChange(Runnable r) { onChange.add(r); } void clear { facts.clear(); pcallFAll(onChange); } }