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

48
LINES

< > BotCompany Repo | #1001514 // Mental nodes (developing)

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

Libraryless. Click here for Pure Java version (703L/6K/17K).

!747
!multi-line strings

m {
  !include #1001509 // rules & statements
  
  static class MentalNode {
    S id = "?" + makeRandomID(8);
    
    new L<S> names; // first name is normally used
    new L<MentalNode> isA;
    
    S getName() {
      ret names.isEmpty() ? id : names.get(0);
    }
  }
  
  static S anonymous() {
    ret "?" + makeRandomID(6);
  }
  
  static new L<MentalNode> nodes;
  
  p {
    MentalNode computer = newNode("computer", "computer (the concept)");
    MentalNode notebook = newNode("teubizvjbppd", "my notebook");
    notebook.isA.add(computer);
    MentalNode server = newNode("onxytkatvevr", "my server");
    server.isA.add(computer);
    
    print("Nodes:");
    print(indent(2, structureList(nodes)));
  }
  
  // show structure of a list in multiple lines
  static S structureList(L l) {
    new L<S> bla;
    for (O x : l) bla.add(structure(x));
    ret fromLines(bla);
  }
  
  static MentalNode newNode(S... names) {
    new MentalNode n;
    n.names.addAll(asList(names));
    nodes.add(n);
    ret n;
  }
}

Author comment

Began life as a copy of #1001511

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1001514
Snippet name: Mental nodes (developing)
Eternal ID of this version: #1001514/1
Text MD5: 946b3721d1b1b3830ba4c5faff3baee0
Transpilation MD5: e82f5097f7af7947ec98ca8e35a98dc1
Author: stefan
Category:
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-10-21 17:08:12
Source code size: 1099 bytes / 48 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 560 / 628
Referenced in: #3000189 - Answer for stefanreich(>> t bla)
#3000382 - Answer for ferdie (>> t = 1, f = 0)
#3000383 - Answer for funkoverflow (>> t=1, f=0 okay)