| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| I know that [a,b,c] is a closed list and that [a,b|X] is an open list. What about [a,b|c] ? Is that open or closed (or not a list at all)? I presume a standard defn for a list/1 test would be list([]). list([_|_]). so that would make [a,b|c] a list or should such a test be recursive? Then the question would then be does [a,b|X] pass the test (even if X is instantiated to c). Is there a standard name for lists constructed from "cons" operators whose "ultimate tail" is [] - e.g. lists like [a,b,c] as opposed to [a,b|X] or [a,b|c] - is that what a closed list really is? Peter |
|
#2
| |||
| |||
| Peter Robinson <pjr@itee.uq.edu.au> writes: >I know that [a,b,c] is a closed list and that [a,b|X] is an open list. >What about [a,b|c] ? Is that open or closed (or not a list at all)? Standard terminology is: [a,b,c] ... list [a,b|X] ... partial list [a,b|c] ... neither a list nor a partial list So there are instances of partial lists that are neither lists nor partial lists. Note, that also X alone is a partial list. The notion open is used for streams and syntax only. In jargon - not standard terminology - the last is sometimes called a malformed list. The [b|c] is also referred to as a dotted pair (~ Lisp-terminology). |
|
#3
| |||
| |||
| I think the terminology covering the topic could be 'incomplete data structures'. This refer to the tecnique used, for instance, for 'difference lists', where the logical variables allow interesting behaviour, loosely related to lazy evaluation (googling for 'difference lists', see for example http://www.cs.cmu.edu/~fp/courses/lp...es/11-diff.pdf). Anyway, a list [a,b|c] is incorrect (IMO) in the sense that the algorithms normally applied (i.e. append) don't perform the expected task. This is a consequence of the fact that a list is simply syntax sugar for the 'dotted pair' notation, al Ulrich pointed out, and the algorithms are coded against the most useful nil (i.e. []) terminated list. Bye Carlo "Peter Robinson" <pjr@itee.uq.edu.au> ha scritto nel messaggio news:newscache$xrm86k$fz8$1@lbox.itee.uq.edu.au... > > > I know that [a,b,c] is a closed list and that [a,b|X] is an open list. > What about [a,b|c] ? Is that open or closed (or not a list at all)? > > I presume a standard defn for a list/1 test would be > > list([]). > list([_|_]). > > so that would make [a,b|c] a list > > or should such a test be recursive? > > Then the question would then be does [a,b|X] pass the test (even if X is > instantiated to c). > > Is there a standard name for lists constructed from "cons" operators whose > "ultimate tail" is [] - e.g. lists like [a,b,c] as opposed to [a,b|X] or > [a,b|c] - is that what a closed list really is? > > Peter |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.