Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,32 @@
|
|||
:- object(team).
|
||||
|
||||
:- threaded.
|
||||
|
||||
:- public(start/0).
|
||||
start :-
|
||||
threaded((
|
||||
reader,
|
||||
writer(0)
|
||||
)).
|
||||
|
||||
reader :-
|
||||
open('input.txt', read, Stream),
|
||||
repeat,
|
||||
read_term(Stream, Term, []),
|
||||
threaded_notify(term(Term)),
|
||||
Term == end_of_file,
|
||||
!,
|
||||
close(Stream),
|
||||
threaded_wait(lines(Lines)),
|
||||
write('Number of lines: '), write(Lines), nl.
|
||||
|
||||
writer(N0) :-
|
||||
threaded_wait(term(Term)),
|
||||
( Term == end_of_file ->
|
||||
threaded_notify(lines(N0))
|
||||
; N is N0 + 1,
|
||||
write(Term), nl,
|
||||
writer(N)
|
||||
).
|
||||
|
||||
:- end_object.
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
| ?- ?- team::start.
|
||||
a(0)
|
||||
a(1)
|
||||
a(2)
|
||||
a(3)
|
||||
a(4)
|
||||
a(5)
|
||||
a(6)
|
||||
a(7)
|
||||
a(8)
|
||||
a(9)
|
||||
Number of lines: 10
|
||||
true.
|
||||
Loading…
Add table
Add a link
Reference in a new issue