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).

!759

concepts.

p {
  loadConceptsFrom("#1005337");
  
  Concept cyclic = cnew("Cyclic");
  cset(cyclic, "next", cyclic);
  cnew("Actually", what := cyclic);
  
  for (Concept c : list("Actually")) {
    new IdentityHashMap seen;
    print(renderConcept(c));
    follow(c, 0, seen);
  }
}

svoid follow(Concept c, int indent, IdentityHashMap seen) {
  seen.put(c, c);
  indent += 2;
  L<S> names = dynGetRefNames(c);
  for (S name : names) {
    Concept val = cast cget(c, name);
    bool isSeen = seen.containsKey(val);
    printIndent(indent, name + ": " + renderConcept(val) + (isSeen ? " [seen]" : ""));
    if (!isSeen)
      follow(val, indent, seen);
  }
}

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: 610 / 679
Referenced in: