$ head foo.dat
14 18 20 22 26 27 13
7 10 19 29 31 32 9
...

open('foo.dat', read, H), file_ints(H,Ns), close(H), ! ,
...

file_ints(S, L) :-
    read_line_to_codes(S, Cs),
    (   Cs == end_of_file
    ->  L = []
    ;   phrase(ints(Is), Cs),
        file_ints(S, R),
        L = [Is|R]
    ).

read_ints(F, L) :-
    open(F, read, S),
    file_ints(S, L),
    close(S).

ints(L) --> blanks, (integer(I), ints(Is), {L = [I|Is]} ; {L = []}).

...

It seems there arenot read_line_to_codes and blanks in gprolog ?

Sincerely !


_______________________________________________
Users-prolog mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/users-prolog

Reply via email to