This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/Logtalk/examples/operators/local.lgt
pmoura a7cfc6e799 Logtalk 2.29.5 files.
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1859 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
2007-03-28 22:50:26 +00:00

46 lines
706 B
Plaintext

% simple example of defining an operator local to a source file
:- op(200, xfx, edge). % global operator, visible within all
% entities defined in this source file
:- object(graph).
:- public(path/3).
:- public((edge)/2).
path(Start, End, [Start, End]) :-
::(Start edge End).
path(Start, End, [Start| Path]) :-
::(Start edge Node),
path(Node, End, Path).
:- end_object.
:- object(graph1,
extends(graph)).
a edge b.
a edge c.
b edge d.
c edge d.
:- end_object.
:- object(graph2,
extends(graph)).
v1 edge v2.
v1 edge v3.
v2 edge v4.
v3 edge v4.
:- end_object.
:- op(0, xfx, edge). % "undefine" the operator, effectively
% making it local to this source file