!7 replace Var with ValuelessVar. replace VarMap with Map<Var, O>. abstract sclass Prop implements IStatement, IFieldsToList {} static withToList record $HappensBefore$<A, B>(A event1, B event2) extends Prop {} static withToList record $HappensAtDay$<A, B>(A event, B y) extends Prop {} static withToList record $LessThan$<A, B>(A x, B y) extends Prop {} static withToList record $BiggerThanOrEqualTo$<A, B>(A x, B y) extends Prop {} static withToList record $AnyIntBiggerThan(O x) {} static withToList record $is$(O a, O b) {} // full define $LessThan(int x, int y) = x < y; static Bool checkProposition(Prop p) { if p is $LessThan$(int x, int y) { ret x < y; } if p is $BiggerThanOrEqualTo$(int x, int y) { ret not(checkProposition($LessThan$(x, y))); } null; } static VarMap fillVariablesInProposition(Prop p) { if p is $LessThan$(int x, Var y) { $AnyIntBiggerThan } } p-exp { assertEqualsVerbose(true, checkProposition($LessThan$(1, 5))); assertEqualsVerbose(false, checkProposition($LessThan$(5, 1))); assertEqualsVerbose(null, checkProposition($LessThan$("what", "ever"))); assertEqualsVerbose(false, checkProposition($BiggerThanOrEqualTo$(1, 5))); assertEqualsVerbose(true, checkProposition($BiggerThanOrEqualTo$(5, 1))); assertEqualsVerbose(null, checkProposition($BiggerThanOrEqualTo$("what", "ever"))); }
Began life as a copy of #1025427
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1025428 |
Snippet name: | Propositions to objects, step 3: infer a variable (dev.) |
Eternal ID of this version: | #1025428/1 |
Text MD5: | 125112ed91b23e05c093ee8f9b2dd223 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-09-28 23:28:26 |
Source code size: | 1388 bytes / 37 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 241 / 437 |
Referenced in: | [show references] |