Logtalk 2.28.2 files.

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1711 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
pmoura
2006-11-07 17:11:47 +00:00
parent 297d94b096
commit 36a326908c
196 changed files with 4726 additions and 2865 deletions

View File

@@ -7,7 +7,70 @@
/* The first two parametric objects represent time and date values as
/* The first parametric object defines some useful predicates for working
with lists.
*/
% dealing with non-empty lists is easy:
:- object(.(_, _)). % note that the [X, Y, ...] notation
% is just syntactic sugar for ./2
:- public(last/1).
:- mode(last(?term), zero_or_one).
:- public(member/1).
:- mode(member(?term), zero_or_more).
:- public(nextto/2).
:- mode(nextto(?term, ?term), zero_or_more).
last(Last) :-
this([Head| Tail]),
last(Tail, Head, Last).
last([], Last, Last).
last([Head| Tail], _, Last) :-
last(Tail, Head, Last).
member(Element) :-
this(List),
member(Element, List).
member(Element, [Element| _]).
member(Element, [_| Tail]) :-
member(Element, Tail).
nextto(X, Y) :-
this([Head| Tail]),
nextto(X, Y, [Head| Tail]).
nextto(X, Y, [X, Y| _]).
nextto(X, Y, [_| Tail]) :-
nextto(X, Y, Tail).
:- end_object.
% dealing with empty lists must also be done but it's a bit tricky:
:- object([], % the empty list is an atom, not a compound term,
extends([.(_, _)])). % so the "extends" relation would be always wrong
last(_) :- % the trick is to redefine all inherited predicates
fail. % to do the right thing for empty lists
member(_) :-
fail.
nextto(_, _) :-
fail.
:- end_object.
/* The next two parametric objects represent time and date values as
compound terms using the object's identifiers.
*/
@@ -143,7 +206,7 @@
updated object identifier.
*/
:- object(rectangle(_width, _height, _x, _y)).
:- object(rectangle(_Width, _Height, _X, _Y)).
:- info([
version is 1.0,