I have noticed that while working with pydatalog.create_terms, a tedious task of single-letter variable creations ('X,Y,Z,P...') was needed to be able to then write a query either on a logical function "func[]" or on a "set()".
It reminded me of "Sympy", which copes with the same kind of issues :
Sympy :
http://www.sympy.org core symbol management :
http://docs.sympy.org/latest/modules/core.html#module-sympy.core.symbolPerhaps a helper function would be very useful in pyDatalog, as "from pyDatalog import symbols" et voila ! Here are the variables X,Y,Z and others...
Moreover, the sympy guys have a dreadful function, "lambdify".
http://docs.sympy.org/dev/modules/utilities/lambdify.htmlA string is supplied in the sympy objects' machinery, it is converted into a formula, for instance it is derived from "X", then the result is collected to be converted into a Pythonic lambda.
I had the idea that such a functionality could be implemented into pyDatalog, convert a rules & facts defined function into a pythonic lambda.
In so far as the "lambda" is not lexically closed (which is often a problem for devs), and that on the pyDatalog side the knowledge base is in a registry (if I have undersstood correctly), both concepts could match entirely on a memory management point of view ...?