Libraryless. Click here for Pure Java version (2870L/18K/65K).
!752 !include #1004863 // Dynamic Concepts sclass CKnownString extends Concept { S s; *() {} *(S *s) {} } sclass CUnknownString extends Concept {} sclass CUnknownCharacter extends Concept {} sclass CKnownCharacter extends Concept { char c; *() {} *(char *c) {} } sclass CharInString extends Concept { new Ref string; int index; *() {} *(Concept string, int *index) { this.string.set(string); } } sclass CUnknownInt extends Concept {} sclass CKnownInt extends Concept { BigInteger value; *() {} *(int value) { this.value = bigint(value); } } sclass CKnownEquals extends Concept { new RefL what; } sclass Question extends Concept {} sclass WhichCharacterIsIt extends Question { new Ref character; new Ref answer; *() {} *(Concept character) { this.character.set(character); } } p { CKnownString s = new CKnownString("hello world"); CharInString c = new CharInString(s, 3); WhichCharacterIsIt question = new WhichCharacterIsIt(c); tryToAnswer(question); } svoid tryToAnswer(WhichCharacterIsIt question) { // We need a rewriting engine here }
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: | 691 / 821 |
| Referenced in: | [show references] |