Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

23
LINES

< > BotCompany Repo | #1012648 // ai_tripleToTripleRef

JavaX fragment (include)

1  
sbool ai_tripleToTripleRef_debug;
2  
3  
static TripleRef<Symbol> ai_tripleToTripleRef(TripleWeb w, Symbol searchTerm, int occurrence) {
4  
  if (ai_tripleToTripleRef_debug) {
5  
    print("ai_tripleToTripleRef: " + w + " " + searchTerm + " " + occurrence);
6  
    //print("a: " + symbolToStringFull(w.a));
7  
    //print("searchTerm: " + symbolToStringFull(searchTerm));
8  
    print("eq: "+ eqic(w.a, searchTerm) + " " + eqic(w.b, searchTerm) + " " + eqic(w.c, searchTerm));
9  
  }
10  
  
11  
  if (w == null) null;
12  
  // occurrence count magic
13  
  if (occurrence < 3)
14  
    for (int i = 0; i < 3; i++)
15  
      if (eqic(tripleGet(w, i), searchTerm)) {
16  
        if (occurrence-- == 0) {
17  
          if (ai_tripleToTripleRef_debug)
18  
            print("ai_tripleToTripleRef returning: " + i);
19  
          ret tripleRef(w, i);
20  
        }
21  
      }
22  
  null;
23  
}

Author comment

Began life as a copy of #1012354

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: #1012648
Snippet name: ai_tripleToTripleRef
Eternal ID of this version: #1012648/8
Text MD5: 3966ccacf00ecea9ce561c88786c995f
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 21:18:22
Source code size: 829 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 485 / 530
Version history: 7 change(s)
Referenced in: [show references]