root/trunk/library/list1.lgt

Revision 4216, 388 bytes (checked in by pmoura, 7 months ago)

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.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1
2:- object(list(_Type),
3    extends(list)).
4
5    :- info([
6        version is 1.1,
7        author is 'Paulo Moura',
8        date is 2008/4/22,
9        comment is 'List predicates with elements constrained to a single type.']).
10
11    valid(-) :-     % catch variables and lists with unbound tails
12        !,
13        fail.
14    valid([]).
15    valid([Element| List]) :-
16        parameter(1, Type),
17        Type::valid(Element),
18        valid(List).
19
20:- end_object.
Note: See TracBrowser for help on using the browser.