Chris Rathman wrote:
I appreciate the help I've gotten and hope not to wear out my welcome, but I'm stuck again. This is probably not the sort of problem for a Oz newbie like myself to tackle, but it's the one in my path at the moment. Not sure I can clearly state the problem, but here goes....

If I have an unbound variable (Z) in the last position of a list like say:

 X|Y|Z

Then the structure of the variable Z in the tail could theoretically be any of the following possibilities along an infinite choice of possibilities:

 A|B|C|Z = _|_|_|nil         %% Z = nil
 A|B|C|Z = _|_|_|_|nil       %% Z = _|nil
 A|B|C|Z = _|_|_|_|_|nil     %% Z = _|_|nil
 ....                        %% Z = _|_|...|nil

And so on. What I'd like is to have a function that generates the possible choices of the infinite variety of structures that are possible when an unbound variable is in the last position of the list.

You can write a predicate (procedure) IsList that enforces its argument to be a list:

proc {IsList X}
   choice
      X=nil
   [] T in X=_|T {IsListT}
   end
end

Does this fit your needs?

Cheers,
raph

_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to