I have a text file with some information, each line is a list of values. I want to read each line and store it in a list with all the other lines. This is the code I have so far
getLines:-
open('textFile.abc', read, Source),
readData(Source,DataList),
write(DataList).
readData(Source,DataList):-
read(Source,NewLine),
NewLine== end_of_file -> fail;true,
readData(Source,[DataList|NewLine]).
readData(Source,[DataList|end_of_file]).
this is the text file 'textfile.abc'
[0.45,20,850,900,3].
[0.45,20,850,900,2].
[0.45,20,850,900,1].
When I run getLines it executes and writes '_G1147068' instead of the list of items. I'm not sure what I'm doing wrong here, any help would be appreciated.