Hilog supports something called "generic programs". You can think of these as query literals you can pass around and call, bit like function literals.

Because Hilog is untyped it uses a separate parenthesis to allow query literals to be passed:
http://www.cs.sunysb.edu/~warren/xsbbook/node46.html
"... snip ....
closure(R)(X,Y) :- R(X,Y).
closure(R)(X,Y) :- R(X,Z), closure(R)(Z,Y).
Now given any binary relation, one can use use this definition to compute its closure. For example, we can define a binary predicate, parent as follows:
:- hilog parent.
parent(able,adam).
parent(able,eve).
parent(cain,adam).
parent(cain,eve).
etc
and then we can use the generic definition of closure to find anscestors:
| ?- clo
... snip ...."

We could supprt this if we added generics to our query literals, probably something like:

query closure( Query<String, String> q, String x, String y ) 
    q( x, y )
    or
    ( q( x, z ) and q(z, y) )
end

Anyway something worth thinking on, when we start to look at function literal support in Drools, we should probably address the two at the same time.

Mark