users-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Incomplete lists in Prolog


From: Jasper Taylor
Subject: Incomplete lists in Prolog
Date: Wed, 06 May 2009 14:54:47 +0100
User-agent: Thunderbird 2.0.0.21 (X11/20090409)

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]