Show
Ignore:
Timestamp:
04/22/08 08:09:59 (8 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/varlist.lgt

    r3687 r4216  
    44 
    55    :- info([ 
    6         version is 1.0, 
     6        version is 1.1, 
    77        author is 'Paulo Moura', 
    8         date is 2000/7/24, 
     8        date is 2008/4/22, 
    99        comment is 'List of variables predicates.']). 
    1010 
     
    2626        prefix(Tail1, Tail2). 
    2727 
    28     valid(List) :- 
    29         nonvar(List), 
    30         \+ \+ valid2(List). 
    31  
    32     valid2([]). 
    33     valid2([Head| Tail]) :- 
    34         var(Head), 
    35         valid2(Tail). 
     28    valid(-) :-     % catch variables and lists with unbound tails 
     29        !, 
     30        fail. 
     31    valid([]). 
     32    valid([Element| List]) :- 
     33        var(Element), 
     34        valid(List). 
    3635 
    3736:- end_object.