!7 concept TheList { S name; new L entries; } concept Selection { TheList list; } static TheList list; p { db(); list = uniq(Selection).list; if (list == null) selectList("cool things"); if (isMainProgram()) botSleep(); } synchronized answer { if "select list *" { selectList($1); ret "OK, has " + n(theList().entries, "entry"); } if "which list" { ret list.name; } if "add * to list" { theList().entries.add($1); theList().change(); ret "OK, has position " + l(theList().entries); } if "add * to list at position *" { int i = parseInt($2)-1; theList().entries.add(i, $1); theList().change(); ret "OK"; } if "take * out of list" { int i = theList().entries.indexOf($1); if (i < 0) ret "Not in list"; else { theList().entries.remove(i); theList().change(); } ret "OK, removed from position " + (i+1); } if "length of list" ret lstr(theList().entries); if "entry * in list" { S entry = get(theList().entries, parseInt($1)-1); ret entry == null ? "Nuttn" : "Entry: " + quote(entry); } } static TheList theList() { ret list; } svoid selectList(S name) { list = uniq(TheList, +name); cset(uniq(Selection), +list); }