From: Tim Vieira Date: Tue, 16 Jul 2013 18:35:39 +0000 (-0400) Subject: () X-Git-Url: https://hydra-www.ietfng.org/gitweb/?a=commitdiff_plain;h=71d5acfdd08ced2f5b8ee0e582b7cfc7739e22d9;p=dyna2 () --- diff --git a/src/Dyna/Backend/Python/interpreter.py b/src/Dyna/Backend/Python/interpreter.py index 587e4ee..99fdbfd 100644 --- a/src/Dyna/Backend/Python/interpreter.py +++ b/src/Dyna/Backend/Python/interpreter.py @@ -367,7 +367,7 @@ class Interpreter(object): init, query) - fn = '$rule/%s' % (len(args) + 1) + fn = '$rule/%s' % len(args) if self.agg_name[fn] is None: self.new_fn(fn, ':=') diff --git a/test/repl/recursion-limit.dynadoc b/test/repl/recursion-limit.dynadoc new file mode 100644 index 0000000..b20995a --- /dev/null +++ b/test/repl/recursion-limit.dynadoc @@ -0,0 +1,29 @@ +% in this example we forget to include a base case so we end up recursing +% forever, but thanks to the python runtime this throws an exception and we +% catch it. + +> :- backchain f/1. +| f(X) = f(X-1). + +% add this rule separately to make sure its an initialization failure +> a = f(3). + +> rules + +Rules +===== + 0: f(X) = f(X-1). + 1: a = f(3). <-- uninitialized + +> sol + +Solution empty. + +Errors +====== +Uninitialized rules +=================== +Failed to initialize rule: + a = f(3). + due to `maximum recursion depth exceeded` + a = f(3)=?.