Show
Ignore:
Timestamp:
04/22/08 08:09:59 (5 months ago)
Author:
pmoura
Message:

Updated the definitions of the predicate valid/1 for the library objects "list", "list(Type)", "numberlist", "set", "set(Type)", "varlist" to fail for lists with unbound tails after discussion with Jan Wielemaker and Ulrich Neumerkel.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/library/list.lgt

    r3687 r4216  
    55 
    66    :- info([ 
    7         version is 1.3, 
     7        version is 1.4, 
    88        author is 'Paulo Moura', 
    9         date is 2006/12/21, 
     9        date is 2008/4/22, 
    1010        comment is 'List predicates.']). 
    1111 
     
    203203        suffix(List, Tail). 
    204204 
    205     valid(List) :- 
    206         nonvar(List), 
    207         \+ \+ valid2(List). 
    208  
    209     valid2([]). 
    210     valid2([_| List]) :- 
    211         valid2(List). 
     205    valid(-) :-     % catch variables and lists with unbound tails 
     206        !, 
     207        fail. 
     208    valid([]). 
     209    valid([_| List]) :- 
     210        valid(List). 
    212211 
    213212:- end_object.