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

1  
!747
2  
!multi-line strings
3  
4  
m {
5  
  !include #1001509 // rules & statements
6  
  
7  
  static class MentalNode {
8  
    S id = "?" + makeRandomID(8);
9  
    
10  
    new L<S> names; // first name is normally used
11  
    new L<MentalNode> isA;
12  
    
13  
    S getName() {
14  
      ret names.isEmpty() ? id : names.get(0);
15  
    }
16  
  }
17  
  
18  
  static S anonymous() {
19  
    ret "?" + makeRandomID(6);
20  
  }
21  
  
22  
  static new L<MentalNode> nodes;
23  
  
24  
  p {
25  
    MentalNode computer = newNode("computer", "computer (the concept)");
26  
    MentalNode notebook = newNode("teubizvjbppd", "my notebook");
27  
    notebook.isA.add(computer);
28  
    MentalNode server = newNode("onxytkatvevr", "my server");
29  
    server.isA.add(computer);
30  
    
31  
    print("Nodes:");
32  
    print(indent(2, structureList(nodes)));
33  
  }
34  
  
35  
  // show structure of a list in multiple lines
36  
  static S structureList(L l) {
37  
    new L<S> bla;
38  
    for (O x : l) bla.add(structure(x));
39  
    ret fromLines(bla);
40  
  }
41  
  
42  
  static MentalNode newNode(S... names) {
43  
    new MentalNode n;
44  
    n.names.addAll(asList(names));
45  
    nodes.add(n);
46  
    ret n;
47  
  }
48  
}

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: 561 / 629
Referenced in: [show references]