Hello Harrison,
that
passThrough predicate from the example is quite useless. It is just a rigorously stripped down version of my 'real' code. For the example I deleted everything, which is not needed to demonstrate the issue.
Obviously there is a work around to the problem. Just expand the construction to
Code: Select all
Y1 = passThrough(0, _Y1),
Y2 = passThrough(Y1, _Y2),
L2 = [[Y1, Y2]],
stdIo::write("L2 = ", L2, ", Y2 = ", Y2, '\n').
OK, so your question is: What use do I have for "pathThrough" predicates? In my 'real' code the class declaration contains amongst others these predicates:
Code: Select all
predicates
var : (
universe{Atomic} Universe0,
universe{Atomic} Universe1 [out])
-> refTerm{Atomic} NewVariable.
predicates
unify :(
refTerm{Atomic} Rt_a,
refTerm{Atomic} Rt_b,
universe{Atomic} Universe0,
universe{Atomic} Universe1)
procedure (o, i, i, o)
procedure (i, o, i, o)
procedure (o, o, i, o)
determ (i, i, i, o).
predicates
append : (
refTerm{Atomic} ListRtA,
refTerm{Atomic} ListRtB,
refTerm{Atomic} ListRtAB,
universe{Atomic} Universe0,
universe{Atomic} Universe1 [out])
nondeterm.
The purpose of the class is to implement reference variables (cf.
tutorial). I've been struggling with that topic for some time (
Determ besides Side Effects,
Callback Actions for Exceptions and Failure). The challenge is, to set up a
unify predicate, which is
determ and does not impose restrictions to the use of cuts.
In my solution the reference variables are not objects but are of an algebraic domain (i.e.
refTerm{Atomic}). The bindings of the reference variables are not stored inside the variables, but are held altogether in a variable of the algebraic type
universe{Atomic}. So, most predicates of the class have two universe parameters. The first is to input the already done bindings, and the second to output the (possibly) updated bindings.
Consider a call to a list append predicate, which looks in some standard prolog for example like
append(ListA, _, ListAB). The call has no solution (i.e. fails immediately), iff
ListA cannot be unified with any front part of
ListAB. With my class (when the current universe is say for example
U7) an equivalent call could be
Code: Select all
append(ListA, var(U7, U8), ListAB, U8, U9)
But, as told, that doesn't work fine. Instead I must code
Code: Select all
ListB = var(U7, U8),
append(ListA, ListB, ListAB, U8, U9)
That's the "passThrough" predicate in my 'real' code.
Best regards
Martin