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

63
LINES

< > BotCompany Repo | #1004869 // Strings Fun

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

Libraryless. Click here for Pure Java version (2870L/18K/65K).

1  
!752
2  
3  
!include #1004863 // Dynamic Concepts
4  
5  
sclass CKnownString extends Concept {
6  
  S s;
7  
  
8  
  *() {}
9  
  *(S *s) {}
10  
}
11  
12  
sclass CUnknownString extends Concept {}
13  
14  
sclass CUnknownCharacter extends Concept {}
15  
16  
sclass CKnownCharacter extends Concept {
17  
  char c;
18  
  
19  
  *() {}
20  
  *(char *c) {}
21  
}
22  
23  
sclass CharInString extends Concept {
24  
  new Ref string;
25  
  int index;
26  
  
27  
  *() {}
28  
  *(Concept string, int *index) { this.string.set(string); }
29  
}
30  
31  
sclass CUnknownInt extends Concept {}
32  
33  
sclass CKnownInt extends Concept {
34  
  BigInteger value;
35  
  
36  
  *() {}
37  
  *(int value) { this.value = bigint(value); }
38  
}
39  
40  
sclass CKnownEquals extends Concept {
41  
  new RefL what;
42  
}
43  
44  
sclass Question extends Concept {}
45  
46  
sclass WhichCharacterIsIt extends Question {
47  
  new Ref character;
48  
  new Ref answer;
49  
  
50  
  *() {}
51  
  *(Concept character) { this.character.set(character); }
52  
}
53  
54  
p {
55  
  CKnownString s = new CKnownString("hello world");
56  
  CharInString c = new CharInString(s, 3);
57  
  WhichCharacterIsIt question = new WhichCharacterIsIt(c);
58  
  tryToAnswer(question);
59  
}
60  
61  
svoid tryToAnswer(WhichCharacterIsIt question) {
62  
  // We need a rewriting engine here
63  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1004869
Snippet name: Strings Fun
Eternal ID of this version: #1004869/1
Text MD5: 6d9ec3540d7d2542e9abfaed7f512500
Transpilation MD5: 71e46d9a15912c7fa8ff3257781a2c95
Author: stefan
Category: javax / a. i.
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-09-08 22:49:28
Source code size: 1174 bytes / 63 lines
Pitched / IR pitched: No / No
Views / Downloads: 493 / 583
Referenced in: [show references]