Before we briefly explain the encoding of HiLog terms, let us note that the HiLog syntax is a simple (but notationally very convenient) encoding for Prolog terms, of some special form. In the same way that in Prolog:
The encoding of HiLog terms is performed based upon the existing declarations of hilog symbols. These declarations (see section 3.8.4), determine whether an atom that appears in a functor position of an external representation of a HiLog term, denotes a functor or the first argument of a set of special functors apply. The actual encoding is as follows:
Note that the encoding of HiLog terms described above, implies that even though the HiLog terms:
p(a, b) h(a, b) |
p(a, b) apply(h, a, b) |
We end this short discussion on the encoding of HiLog terms with a small example that illustrates the way the encoding described above is being done. Assuming that the following declarations of parameter symbols have taken place,
:- hilog h. :- hilog (hilog). |
foo(bar) prolog(a,X) apply(hilog,X) apply(123,john,500) apply(X,kostis,sofia) apply(X,Y,Z,apply(Y,W)) f(a,apply(b(c),d)) apply(map(double),[],[]) apply(apply(h,apply(map(P),A,B)),C) |