Changeset 4216
- Timestamp:
- 04/22/08 08:09:59 (2 months ago)
- Location:
- trunk
- Files:
-
- 7 modified
-
library/list.lgt (modified) (2 diffs)
-
library/list1.lgt (modified) (1 diff)
-
library/numberlist.lgt (modified) (2 diffs)
-
library/set.lgt (modified) (2 diffs)
-
library/set1.lgt (modified) (1 diff)
-
library/varlist.lgt (modified) (2 diffs)
-
RELEASE_NOTES.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/library/list.lgt
r3687 r4216 5 5 6 6 :- info([ 7 version is 1. 3,7 version is 1.4, 8 8 author is 'Paulo Moura', 9 date is 200 6/12/21,9 date is 2008/4/22, 10 10 comment is 'List predicates.']). 11 11 … … 203 203 suffix(List, Tail). 204 204 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). 212 211 213 212 :- end_object. -
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. -
trunk/library/numberlist.lgt
r3567 r4216 5 5 6 6 :- info([ 7 version is 1. 1,7 version is 1.2, 8 8 author is 'Paulo Moura', 9 date is 200 7/4/20,9 date is 2008/4/22, 10 10 comment is 'List of numbers predicates.']). 11 11 … … 57 57 sum(Ns, Acc2, Sum). 58 58 59 valid(List) :- 60 nonvar(List), 61 \+ \+ valid2(List). 62 63 valid2([]). 64 valid2([Head| Tail]) :- 65 number(Head), 66 valid2(Tail). 59 valid(-) :- % catch variables and lists with unbound tails 60 !, 61 fail. 62 valid([]). 63 valid([Element| List]) :- 64 number(Element), 65 valid(List). 67 66 68 67 :- end_object. -
trunk/library/set.lgt
r4191 r4216 5 5 6 6 :- info([ 7 version is 1. 0,7 version is 1.1, 8 8 author is 'Paulo Moura', 9 date is 200 0/7/24,9 date is 2008/4/22, 10 10 comment is 'Set predicates implemented using ordered lists. Uses ==/2 for element comparison and standard term ordering.']). 11 11 … … 179 179 union([Head1| Tail1], Tail2, Union). 180 180 181 valid(Set) :- 182 nonvar(Set), 183 valid2(Set). 181 valid(-) :- % catch variables 182 !, 183 fail. 184 valid([]) :- 185 !. 186 valid([Element| Set]) :- 187 check_order(Set, Element). 184 188 185 valid2([]) :- 189 check_order(-, _) :- % catch unbound tails 190 !, 191 fail. 192 check_order([], _) :- 186 193 !. 187 valid2([_]) :- 188 !. 189 valid2([Element1, Element2| Set]) :- 190 Element1 @< Element2, 191 valid2([Element2| Set]). 194 check_order([Element2| Set], Element1) :- 195 Element2 @> Element1, 196 check_order(Set, Element2). 192 197 193 198 :- end_object. -
trunk/library/set1.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 'Set predicates with elements constrained to a single type.']). 10 10 11 valid(Set) :- 12 nonvar(Set), 11 valid(-) :- % catch variables 12 !, 13 fail. 14 valid([]) :- 15 !. 16 valid([Element| Set]) :- 17 check_order(Set, Element). 18 19 check_order(-, _) :- % catch unbound tails 20 !, 21 fail. 22 check_order([], _) :- 23 !. 24 check_order([Element2| Set], Element1) :- 13 25 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 26 Type::valid(Element1), 24 27 Type::valid(Element2), 25 valid([Element2| Set], Type). 28 Element2 @> Element1, 29 check_order(Set, Element2). 26 30 27 31 :- end_object. -
trunk/library/varlist.lgt
r3687 r4216 4 4 5 5 :- info([ 6 version is 1. 0,6 version is 1.1, 7 7 author is 'Paulo Moura', 8 date is 200 0/7/24,8 date is 2008/4/22, 9 9 comment is 'List of variables predicates.']). 10 10 … … 26 26 prefix(Tail1, Tail2). 27 27 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). 36 35 37 36 :- end_object. -
trunk/RELEASE_NOTES.txt
r4214 r4216 62 62 installation script to use the "C:\lgtsvn" as base. Simplified manual 63 63 installation instructions. 64 65 Updated the definitions of the predicate valid/1 for the library objects 66 "list", "list(Type)", "numberlist", "set", "set(Type)", "varlist" to fail 67 for lists with unbound tails after discussion with Jan Wielemaker and 68 Ulrich Neumerkel. 64 69 65 70 Added a simple example, "debug_hooks", of using compilation hooks and
