persistable sclass UpDownSequence extends RandomAccessAbstractList { new BitBuffer moves; // up is true *(S s) { for (c : characters(upper(s))) if (c == 'U') add(UpDown.up); else if (c == 'D') add(UpDown.down); } public UpDown get(int i) { ret UpDown.fromBool(moves.get(i)); } public bool add(UpDown move) { moves.add(move.bit); true; } toString { ret join(countIterator moveChar(size())); } S moveChar(int i) { ret moves.get(i) ? "U" : "D"; } public int size() { ret moves.size(); } }