<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hilog supports something called "generic programs". You can think of
these as query literals you can pass around and call, bit like
function literals.<br>
<br>
Because Hilog is untyped it uses a separate parenthesis to allow
query literals to be passed:<br>
<a class="moz-txt-link-freetext" href="http://www.cs.sunysb.edu/~warren/xsbbook/node46.html">http://www.cs.sunysb.edu/~warren/xsbbook/node46.html</a><br>
<pre>"... snip ....
closure(R)(X,Y) :- R(X,Y).
closure(R)(X,Y) :- R(X,Z), closure(R)(Z,Y).
</pre>
Now given any binary relation, one can use use this definition to
compute its closure. For example, we can define a binary predicate,
<code>parent</code> as follows:
<pre>:- hilog parent.
parent(able,adam).
parent(able,eve).
parent(cain,adam).
parent(cain,eve).
etc
</pre>
and then we can use the generic definition of closure to find
anscestors:
<pre>| ?- 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
</pre>
<br>
<br>
</body>
</html>