Incomplete lists in Prolog

Jasper Taylor <[email protected]>
Newsgroups gmane.comp.gnu.prolog.general
Message-ID <[email protected]>
Hi all,
We are used to being able to create a list with a 'tail' that may 
contain zero or more uninstantiated elements, using syntax like L = [a, 
b, c | Tail]. But why should we not have a list with a section at the 
start or in the middle, maybe even more than one such section, 
containing 0 or more uninstantiated elements? If you go:
L = [a, b, c | Tail], append(L, [d, e, f], L2),
you get a series of solutions with Tail instantiated to different length 
lists. But why shouldn't you get a single solution, something like:
L2 = [a,b,c, '$opening', d,e,f],
which would then unify with any list starting with [a,b,c] and finishing 
with [d,e,f] ? I don't see what is logically different about the end of 
a list from its start or middle, that a representation of an unknown 
number of elements should be allowed there.
    --Jasper
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.