Uses 911K of libraries. Click here for Pure Java version (3227L/17K).
1 | !7 |
2 | |
3 | cmodule TrailsTree { |
4 | switchable S solverModule; |
5 | transient O root; |
6 | transient JTree tree; |
7 | transient SingleComponentPanel scp; |
8 | |
9 | visual scp = singleComponentPanel(makeTree()); |
10 | |
11 | JTree makeTree() { |
12 | ret tree = jDynamicTree(root, lambda1 getChildren); |
13 | } |
14 | |
15 | L getChildren(O o) { |
16 | print("getChildren " + o); |
17 | /*if (isShortNamed LogicRule(o)) { |
18 | o = getOpt trail(o); |
19 | if (o cast S) |
20 | ret ll(o); |
21 | }*/ |
22 | if (o instanceof Pair) { |
23 | O b = o/Pair.b; |
24 | print('shortName, shortName(b)); |
25 | if (isShortNamed LogicRule(b)) { |
26 | O trail = get trail(b); |
27 | print(+trail); |
28 | ret getChildren(trail); |
29 | } |
30 | o = b; |
31 | } |
32 | if (o cast Map) |
33 | ret mapToPairs(o); |
34 | if (o cast L) |
35 | ret o; |
36 | null; |
37 | } |
38 | |
39 | start { |
40 | if (empty(solverModule)) |
41 | setField(solverModule := (S) vmBus_query winogradSolver()); |
42 | |
43 | virtual PhilosophyBot1 engine = dm_rget engine(solverModule); |
44 | L<virtual LogicRule> logicRules = cloneList((Cl) rget logicRules(engine)); |
45 | Map<Int, virtual LogicRule> logicRuleIndex = indexByField n(logicRules); |
46 | L<WithTrail<S>> trails = shallowImportAll((Iterable) rcall deducedFactsWithTrails(engine)); |
47 | setField(root := concatLists( |
48 | map(logicRules, lambda1 ruleToNode), |
49 | map withTrailToPair(trails))); |
50 | } |
51 | |
52 | O ruleToNode(virtual LogicRule rule) { |
53 | ret pair(rule, get trail(rule)); |
54 | } |
55 | } |
Began life as a copy of #1027108
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: | #1027184 |
Snippet name: | Winograd Trails Tree [inspect trails in tree] |
Eternal ID of this version: | #1027184/20 |
Text MD5: | 30f9ede63205f8b44c56fa71ddfdb1f0 |
Transpilation MD5: | 55c12bd9f6dabb99e7d5671bfa9cfcd1 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-02-25 01:56:22 |
Source code size: | 1465 bytes / 55 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 258 / 580 |
Version history: | 19 change(s) |
Referenced in: | [show references] |