Uses 911K of libraries. Click here for Pure Java version (4099L/21K).
1 | cmodule NewEngineSpike > DynPrintLog { |
2 | transient new DeepZipTools tools; |
3 | transient new L<BasicLogicRule> rules; |
4 | transient SS functions = litmap_keysLikeValues(f ewic_notSame); |
5 | |
6 | start-thread { |
7 | S ruleDef = [[hasWord($x) & ewic_notSame($x, "zimmer") => $x ist ein Zimmer]]; |
8 | // rewritten to: for $x where hasWord($x): ewic_notSame($x, "zimmer") => $x ist ein Zimmer |
9 | |
10 | BasicLogicRule rule = ai_newEngine_parseRule(ruleDef, tools); |
11 | ForWhere fw = cast ai_lhsToForWhere(rule, tools); |
12 | print(fw); |
13 | |
14 | stepAll(new AI_ExecuteSimpleForWhere(tools, |
15 | r -> rules.add(print(r)), |
16 | f -> eq(f, "hasWord") ? ll("bla", "Wohnzimmer") : null, |
17 | fw)); |
18 | |
19 | new LS facts; |
20 | for (BasicLogicRule r : rules) |
21 | if (isTrue(ai_evalFunctionCallLHS(r, mapToIF1(functions)))) |
22 | facts.add(ai_fragmentsToStatement(r.rhs)); |
23 | |
24 | assertEqualsVerbose(ll("Wohnzimmer ist ein Zimmer"), facts); |
25 | } |
26 | } |
Began life as a copy of #1027880
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1027908 |
Snippet name: | New Engine Spike [executing for-where and function calls, OK] |
Eternal ID of this version: | #1027908/10 |
Text MD5: | 70f7a58bc833b0156df1db7738044a7d |
Transpilation MD5: | 160c5b2a7a6d6fa41ca097d377c40508 |
Author: | stefan |
Category: | javax / new gazelle |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-04-16 18:11:43 |
Source code size: | 954 bytes / 26 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 233 / 765 |
Version history: | 9 change(s) |
Referenced in: | [show references] |