cascalog.logic.predmacro documentation

This namespace contains functions that help to define predicate
macro instances, and compile predicate macro instances out into
sequences of RawPredicate instances.



(build-predmacro input-decl output-decl raw-predicates)
Build a predicate macro via input and output declarations. This
function takes a sequence of declared inputs, a seq of declared
outputs and a sequence of raw predicates. Upon use, any variable
name not in the input or output declarations will be replaced with a
random Cascalog variable (uniqued by appending a suffix, so nullable
vs non-nullable will be maintained).


(expand _ input output)
Returns a sequence of vectors suitable to feed into



(predmacro & body)
A more general but more verbose way to create predicate macros.

Creates a function that takes in [invars outvars] and returns a
list of predicates. When making predicate macros this way, you must
create intermediate variables with gen-nullable-var(s). This is
because unlike the (<- [?a :> ?b] ...) way of doing pred macros,
Cascalog doesn't have a declaration for the inputs/outputs.



(predmacro* fun)
Functional version of predmacro. See predmacro for details.


(predmacro? o)


(use-as-filter? output-decl outvars)
If a predicate macro had a single output variable defined and you
try to use it with no output variables, the predicate macro acts as
a filter.


(validate-declarations! input-decl output-decl)
Assert that the same variables aren't used on input and output when
defining a predicate macro.