Libraryless. Click here for Pure Java version (5581L/37K/127K).
!759 !include #1005325 // Logic 4 concept AtEachPointInTime { new Ref what; public S toString() { ret shortClassName(this) + " " + what; } } concept ItIs { new Ref what; public S toString() { ret shortClassName(this) + " " + what; } } concept ExactlyOne { new Ref what; public S toString() { ret shortClassName(this) + " " + what; } } concept Which { new Ref what; public S toString() { ret shortClassName(this) + " " + what; } } concept Weekday { public S toString() { ret shortClassName(this); } } p { truly(AtEachPointInTime, uniq(ItIs, uniq(ExactlyOne, uniq(Weekday)))); for (AtEachPointInTime statement : listActually(AtEachPointInTime)) { print("Right now: " + statement.what); Concept question = exactlyOneToWhich(statement.what!); print("Question thus: " + question); } saveConcepts(); } static Concept exactlyOneToWhich(Concept c) { // conversion case we are looking for if (c instanceof ExactlyOne) ret cnew(Which, "what", exactlyOneToWhich((Concept) cget(c, "what"))); // general recurse L<Concept.Ref> refs = c.refs; if (l(refs) == 0) ret c; // no references in it, keep original // clone and process references Concept c2 = cnew(_getClass(c)); Collection<S> names = getRefNames(c); for (S name : names) cset(c2, name, exactlyOneToWhich((Concept) cget(c, name))); ret c2; }
Began life as a copy of #1005336
download show line numbers debug dex old transpilations
Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, nbgitpuheiab, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1005337 |
Snippet name: | Current Weekday [dev.] |
Eternal ID of this version: | #1005337/1 |
Text MD5: | f82f8c4fd0bc678e336f063af7f6e3f5 |
Transpilation MD5: | ee2d4888fe230a4329b3e15c8edfd16b |
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:36:25 |
Source code size: | 1454 bytes / 62 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 510 / 811 |
Referenced in: | #1005340 - Make Concept Graph [dev.] |