!7 cprint { transient LineCompedSingle lc; transient Map literalIndex; transient MultiMap> prodIndex; start-thread { new LineCompCompressor comp; lc = lcString2(comp, "hello world world"); // Turn pairs and file encodings into a single structure ("productions") new LL productions; productions.addAll(intPairsToLists(lc.pairs)); productions.add(lc.main); // build the reconstitution index Map literalIndex = indexList(lc.literals); MultiMap> prodIndex = new MultiMap; for iProd over productions: { L prod = productions.get(iProd); for (int i, int x : unpair iterateListWithIndex(prod)) { prodIndex.put(x, pair(iProd, i)); } } print(+literalIndex); print(+prodIndex); S query = "world"; L queryList = characters(query); new L queryLiterals; for (Char c : queryList) { Int iLit = literalIndex.get(c); if (iLit == null) ret with print("literal not found"); queryLiterals.add(iLit); } print(+queryLiterals); reconstitute(queryList, 0, 1); } void reconstitute(L baseList, int i) { print("Reconstituing " + quote(lcUncompressItem(lc, baseList.get(i))); } }