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

30
LINES

< > BotCompany Repo | #1005340 // Make Concept Graph [dev.]

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (5053L/33K/113K).

1  
!759
2  
3  
concepts.
4  
5  
p {
6  
  loadConceptsFrom("#1005337");
7  
  
8  
  Concept cyclic = cnew("Cyclic");
9  
  cset(cyclic, "next", cyclic);
10  
  cnew("Actually", what := cyclic);
11  
  
12  
  for (Concept c : list("Actually")) {
13  
    new IdentityHashMap seen;
14  
    print(renderConcept(c));
15  
    follow(c, 0, seen);
16  
  }
17  
}
18  
19  
svoid follow(Concept c, int indent, IdentityHashMap seen) {
20  
  seen.put(c, c);
21  
  indent += 2;
22  
  L<S> names = dynGetRefNames(c);
23  
  for (S name : names) {
24  
    Concept val = cast cget(c, name);
25  
    bool isSeen = seen.containsKey(val);
26  
    printIndent(indent, name + ": " + renderConcept(val) + (isSeen ? " [seen]" : ""));
27  
    if (!isSeen)
28  
      follow(val, indent, seen);
29  
  }
30  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1005340
Snippet name: Make Concept Graph [dev.]
Eternal ID of this version: #1005340/1
Text MD5: a98f7fddefb59a6242c395851abd0aa2
Transpilation MD5: b8e81b86cd038d9d6517002cfe1101a7
Author: stefan
Category: javax / a.i.
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-11-07 19:53:15
Source code size: 693 bytes / 30 lines
Pitched / IR pitched: No / No
Views / Downloads: 611 / 681
Referenced in: [show references]