Changeset 4216 for trunk/library/list1.lgt
- Timestamp:
- 04/22/08 08:09:59 (6 months ago)
- Files:
-
- 1 modified
-
trunk/library/list1.lgt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/library/list1.lgt
r2737 r4216 4 4 5 5 :- info([ 6 version is 1. 01,6 version is 1.1, 7 7 author is 'Paulo Moura', 8 date is 200 6/4/25,8 date is 2008/4/22, 9 9 comment is 'List predicates with elements constrained to a single type.']). 10 10 11 valid(List) :- 12 nonvar(List), 11 valid(-) :- % catch variables and lists with unbound tails 12 !, 13 fail. 14 valid([]). 15 valid([Element| List]) :- 13 16 parameter(1, Type), 14 \+ \+ valid(List, Type). 15 16 valid([], _). 17 valid([Value| List], Type) :- 18 Type::valid(Value), 19 valid(List, Type). 17 Type::valid(Element), 18 valid(List). 20 19 21 20 :- end_object.
