1 | static int prolog_tryToDeriveLastLine_maxSteps = 1000; |
2 | |
3 | static bool prolog_tryToDeriveLastLine(S data) { |
4 | // make Prolog interpreter |
5 | new Prolog p; |
6 | p.upperCaseVariables = true; |
7 | //p.showStuff = true; |
8 | p.addTheory(dropLastLine(rtrim(data)), programID()); |
9 | Lisp pivot = nlParse(lastLine(rtrim(data))); |
10 | // try to derive last statement from the rest |
11 | new LinkedHashSet<Lisp> set; |
12 | Collector<Lisp> c = limitedSearchCollector(set, prolog_tryToDeriveLastLine_maxSteps, pivot); |
13 | p.rewriteInto(c); |
14 | print("Found " + nl(set, "statement") + ":"); |
15 | //printIndent(snlAllToText(l)); |
16 | printIndent(nlUnparseLines(asList(set))); |
17 | print(); |
18 | print("Pivot statement: " + nlUnparse(pivot)); |
19 | bool found = set.contains(pivot); |
20 | print("Pivot statement found? " + yn(found)); |
21 | ret found; |
22 | } |
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1005185 |
Snippet name: | prolog_tryToDeriveLastLine |
Eternal ID of this version: | #1005185/1 |
Text MD5: | 74a516339c03716afda18551e08f8e2c |
Author: | stefan |
Category: | javax / prolog |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-10-19 16:03:51 |
Source code size: | 806 bytes / 22 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 526 / 543 |
Referenced in: | [show references] |