Download Jar. Libraryless. Click here for Pure Java version (7051L/50K).
!7 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, A y) extends Prop {} static withToList record $BiggerThanOrEqualTo$<A, B>(A x, A y) extends Prop {} // 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; } 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 #1025420
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, omdjrrnzbjjv, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1025427 |
Snippet name: | Propositions to objects, step 2: implement Prolog-style backwards rule (OK) |
Eternal ID of this version: | #1025427/5 |
Text MD5: | 897c56c673b04edb5882e9c23b6554ee |
Transpilation MD5: | 9da06fe979255c7e14c82aa34311d2f4 |
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:22:51 |
Source code size: | 1101 bytes / 26 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 313 / 1007 |
Version history: | 4 change(s) |
Referenced in: | [show references] |