File "railgun"

Since the recent version of Dogelog Player supports cyclic terms, we could let the Jini out of the bottle, and provide the experimental library(edge/railgun) to model delayed goals with nothing else than the ISO core standard Prolog and Alain Colmerauers rational trees. The result is a Lean CLP of ca. 100 lines of code, that already provides a simple constraint (#\=)/2 and a global constraint all_different/1.

The delay of a goal G(X) on a variable X, creates a circular dependency, modelled by a compound '$ATTR'/2. To access and modify such attributed variables we have introduced the utility predicates deref/2 and bind/2 which are usually not needed in a constraint logic programming implementation. We do not implement the full constraint logic programming schema. For example the bind/2 predicate is not able to alias variables.

The following railgun predicates are provided:

deref(S, T):
The predicate succeeds in T with the value of the term S.
freeze(T, G):
The predicate delays the goal G on the term T.
bind(T, S):
The predicate succeeds when it can bind the term to the term T.
dif(S, T):
The predicate delays the goal S \== T on the terms S and T.
indomain(S, D):
The predicate succeeds in S with the elements of the list D.
all_different(L):
The predicate delays the goal that all elements of L are different.
label(L, D):
The predicate binds the elements of L, left to right, to the elements of D.
labeling(L, D):
The predicate binds the elements of L, heuristically reordered in advance, to the elements of D.