Libraryless. Click here for Pure Java version (7672L/49K).
svoid test_FactStore() { PhilosophyBot1 bot = new([[ $x weighs $y => proc { delete all (last time $x weighed $z) store (last time $x weighed $y) } ]]); //bot.printNonMatches = true; bot.parseProgram(); new SimpleFactStore fs; fs.verbose = true; philosophyBot1_factStore(bot, fs, debug := true); bot.addFact("a weighs (50 pounds)"); bot.addFact("b weighs (55 pounds)"); bot.think(); assertEqualsVerbose(ll( "last time a weighed (50 pounds)", "last time b weighed (55 pounds)"), sorted(fs.facts())); bot.addFact("a weighs (52 pounds)"); bot.think(); assertEqualsVerbose(ll( "last time a weighed (52 pounds)", "last time b weighed (55 pounds)"), sorted(fs.facts())); }
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: | #1025753 |
| Snippet name: | test_FactStore (OK) |
| Eternal ID of this version: | #1025753/9 |
| Text MD5: | a873c4af8f8101e835db23c12ac7f879 |
| Transpilation MD5: | d41bee981c85c724c8fcbc79400e0faf |
| Author: | stefan |
| Category: | javax / a.i. |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2019-10-17 23:06:22 |
| Source code size: | 770 bytes / 25 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 417 / 612 |
| Version history: | 8 change(s) |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |