From 82500e410fb5a61a14fafa73a6c93f7ab16fb4f8 Mon Sep 17 00:00:00 2001 From: Nathaniel Wesley Filardo Date: Fri, 5 Jul 2013 14:12:04 -0400 Subject: [PATCH] Generate update plans for backchained items This is necessary to allow retraction. While here, wire up a backchain example into the test harness. --- examples/expected/factorial-bc.py.out | 5 +++++ examples/{backchain.dyna => factorial-bc.dyna} | 0 src/Dyna/Analysis/RuleMode.hs | 5 ++++- src/Dyna/Backend/Python/Selftest.hs | 2 +- 4 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 examples/expected/factorial-bc.py.out rename examples/{backchain.dyna => factorial-bc.dyna} (100%) diff --git a/examples/expected/factorial-bc.py.out b/examples/expected/factorial-bc.py.out new file mode 100644 index 0000000..5d44b0e --- /dev/null +++ b/examples/expected/factorial-bc.py.out @@ -0,0 +1,5 @@ + +Solution +======== +a = 24. + diff --git a/examples/backchain.dyna b/examples/factorial-bc.dyna similarity index 100% rename from examples/backchain.dyna rename to examples/factorial-bc.dyna diff --git a/src/Dyna/Analysis/RuleMode.hs b/src/Dyna/Analysis/RuleMode.hs index 99de641..dce4559 100644 --- a/src/Dyna/Analysis/RuleMode.hs +++ b/src/Dyna/Analysis/RuleMode.hs @@ -604,10 +604,13 @@ planEachEval bp bc cs r = -- Filter out non-constant evaluations -- -- XXX This instead should look at the update modes of each evaluation + -- + -- XXX Even if we do that, however, we need to be sure that retractable + -- items have the right modes. $ MA.mapMaybe (\ec -> case ec of (n, CCall _ is f) -> let fa = (f,length is) in if not (cs fa) - && not (fa `S.member` bc) + -- && not (fa `S.member` bc) then Just (n, ec) else Nothing (n, CEval _ _ ) -> Just (n,ec)) diff --git a/src/Dyna/Backend/Python/Selftest.hs b/src/Dyna/Backend/Python/Selftest.hs index 45664a8..652750c 100644 --- a/src/Dyna/Backend/Python/Selftest.hs +++ b/src/Dyna/Backend/Python/Selftest.hs @@ -78,7 +78,7 @@ mkExample name = test_End_To_End :: [Test] test_End_To_End = map mkExample [ "simple", "equalities", "fib-limit", "dijkstra", "papa2", "matrixops" - , "geom", "lists", "dijkstra-backpointers" ] + , "factorial-bc", "geom", "lists", "dijkstra-backpointers" ] test_REPL :: [Test] test_REPL = map (\n -> testProgramRuns n ("./test/repl/"++n) []) -- 2.50.1