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

23
LINES

< > BotCompany Repo | #1012648 // ai_tripleToTripleRef

JavaX fragment (include)

sbool ai_tripleToTripleRef_debug;

static TripleRef<Symbol> ai_tripleToTripleRef(TripleWeb w, Symbol searchTerm, int occurrence) {
  if (ai_tripleToTripleRef_debug) {
    print("ai_tripleToTripleRef: " + w + " " + searchTerm + " " + occurrence);
    //print("a: " + symbolToStringFull(w.a));
    //print("searchTerm: " + symbolToStringFull(searchTerm));
    print("eq: "+ eqic(w.a, searchTerm) + " " + eqic(w.b, searchTerm) + " " + eqic(w.c, searchTerm));
  }
  
  if (w == null) null;
  // occurrence count magic
  if (occurrence < 3)
    for (int i = 0; i < 3; i++)
      if (eqic(tripleGet(w, i), searchTerm)) {
        if (occurrence-- == 0) {
          if (ai_tripleToTripleRef_debug)
            print("ai_tripleToTripleRef returning: " + i);
          ret tripleRef(w, i);
        }
      }
  null;
}

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: 484 / 529
Version history: 7 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)