Download Jar. Libraryless. Click here for Pure Java version (7055L/50K).
!7 replace Var with ValuelessVar. replace VarMap with Map<Var, O>. replace SimpleStatements with MatchableRecords<Prop>. abstract sclass Prop implements IFieldsToList {} static withToList record WhenDid$Happen(O event) extends Prop {} static withToList record $HappensAtSecond$<A, B>(A event, B y) extends Prop {} static O answer(O p, SimpleStatements statements) { if p is WhenDid$Happen(O event) { ret statements.fulfillVariable(var -> $HappensAtSecond$(event, var)); } null; } p-exp { SimpleStatements statements = new( $HappensAtSecond$("stuff", 10), $HappensAtSecond$("more stuff", 20) ); assertEqualsVerbose(10, answer(print(WhenDid$Happen("stuff")), statements)); assertEqualsVerbose(20, answer(print(WhenDid$Happen("more stuff")), statements)); assertEqualsVerbose(null, answer(print(WhenDid$Happen("something else")), statements)); }
Began life as a copy of #1025428
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: | #1025429 |
| Snippet name: | Propositions to objects, step 4 - fill variable from facts (OK) |
| Eternal ID of this version: | #1025429/14 |
| Text MD5: | 913d8fd845e97d827a1999e628b75b7f |
| Transpilation MD5: | af2ad6464b44ed655c1c433fa1cd3a54 |
| 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:52:17 |
| Source code size: | 901 bytes / 27 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 502 / 1580 |
| Version history: | 13 change(s) |
| Referenced in: | #1025431 - Propositions to objects, step 5 - multi-step procedure (OK) |