sbool ai_triplesToTripleRefs_lazyList_debug; static L> ai_triplesToTripleRefs_lazyList(final Symbol searchTerm, final L l) { if (l == null) null; class TTTRList extends LazyList> { final int n = l(l); public int size() { ret n; } public TripleRef get(int i) { if (ai_triplesToTripleRefs_lazyList_debug) print("tttrlist.get " + i + "/" + l(l)); TripleWeb w = syncGet(l, i); if (w == null) null; // run-length magic - TODO: concatenated lists int runLength = 0; while (i-runLength > 0 && l.get(i-runLength-1) == w) ++runLength; ret ai_tripleToTripleRef(l.get(i), searchTerm, runLength); // may be null } } ret new TTTRList; }