root/trunk/examples/operators/triple.lgt

Revision 4601, 0.6 KB (checked in by pmoura, 7 weeks ago)

Added svn:mime-type property to source files (set to text/x-logtalk).

  • Property svn:mime-type set to text/x-logtalk
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1
2:- object(triple).
3
4
5    :- info([
6        version is 1.0,
7        author is 'Paulo Moura',
8        date is 2004/2/16,
9        comment is 'Read and asserts a simple table of facts from a file for testing operator handling code.']).
10
11    :- public(triple/2).
12    :- dynamic(triple/2).
13
14    :- op(500, xfx, triple).
15
16    :- initialization(read_from_file).
17
18
19    read_from_file :-
20        open('triple.txt', read, Stream),
21        read(Stream, Term),
22        process(Stream, Term).
23
24    process(Stream, end_of_file) :-
25        close(Stream),
26        !.
27
28    process(Stream, Term) :-
29        assertz(Term),
30        read(Stream, Next),
31        process(Stream, Next).
32
33
34:- end_object.
Note: See TracBrowser for help on using the browser.