1 | sbool ai_triplesToTripleRefs_lazyList_debug; |
2 | |
3 | static L<TripleRef<Symbol>> ai_triplesToTripleRefs_lazyList(final Symbol searchTerm, final L<TripleWeb> l) { |
4 | if (l == null) null; |
5 | class TTTRList extends LazyList<TripleRef<Symbol>> { |
6 | final int n = l(l); |
7 | public int size() { ret n; } |
8 | public TripleRef<Symbol> get(int i) { |
9 | if (ai_triplesToTripleRefs_lazyList_debug) print("tttrlist.get " + i + "/" + l(l)); |
10 | TripleWeb w = syncGet(l, i); |
11 | if (w == null) null; |
12 | |
13 | // run-length magic - TODO: concatenated lists |
14 | int runLength = 0; |
15 | while (i-runLength > 0 && l.get(i-runLength-1) == w) |
16 | ++runLength; |
17 | |
18 | ret ai_tripleToTripleRef(l.get(i), searchTerm, runLength); // may be null |
19 | } |
20 | } |
21 | ret new TTTRList; |
22 | } |
Began life as a copy of #1012352
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1012649 |
Snippet name: | ai_triplesToTripleRefs_lazyList |
Eternal ID of this version: | #1012649/10 |
Text MD5: | 775358af757e47d05eab2e65740a6df3 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-12-10 19:53:51 |
Source code size: | 790 bytes / 22 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 497 / 496 |
Version history: | 9 change(s) |
Referenced in: | [show references] |