root/tags/lgt2305/library/set1.lgt

Revision 2737, 0.5 KB (checked in by pmoura, 3 years ago)

Avoid false singleton warnings with named anonymous variables on recent version of SWI-Prolog.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1
2:- object(set(_Type),
3    extends(set)).
4
5    :- info([
6        version is 1.01,
7        author is 'Paulo Moura',
8        date is 2006/4/25,
9        comment is 'Set predicates with elements constrained to a single type.']).
10
11    valid(Set) :-
12        nonvar(Set),
13        parameter(1, Type),
14        \+ \+ valid(Set, Type).
15
16    valid([], _) :-
17        !.
18    valid([Element], Type) :-
19        !,
20        Type::valid(Element).
21    valid([Element1, Element2| Set], Type) :-
22        Element1 @< Element2,
23        Type::valid(Element1),
24        Type::valid(Element2),
25        valid([Element2| Set], Type).
26
27:- end_object.
Note: See TracBrowser for help on using the browser.