I am having a problem of reading a text file that contains this information:
T11, R1, 6:00-18:00 T12, R1, 6:00-18:00 T13, R1, 18:00-6:00
For now I have a prolog code for reading it , if I add '' in each line and period in the end. It converts it to one List , but I need separate lists for each line. I also tried to use:
/*rows(Total,Rows_list):-
atomic_list_concat(Rows_list,nl, Total),
write(Rows_list), nl.*/
But it does not work and displays error message of too long string.
main :-
open('taxi.txt', read, Str),
read_file(Str,Lines),
close(Str),
write(Lines),
nl.
read_file(Stream,[]) :-
at_end_of_stream(Stream).
read_file(Stream,[X|L]) :-
\+ at_end_of_stream(Stream),
read(Stream,X),
read_file(Stream,L).
/*rows(Total,Rows_list):-
atomic_list_concat(Rows_list,nl, Total),
write(Rows_list), nl.*/