I have a input predicate will read the file as a list: input(Filename,List). The list then will be in the format of
[\"_\",\"_\",\"_\",9,\"_\",\"_\"]
to_var_list([],[]).
to_var_list([A|R1],[B|R2]):-
(A = '_' ->
true;
A = B),
to_var_list(R1,R2).
Exchange '_'
with "_"
if you actually have one character strings and not underscore atoms.
Also, there is a read
predicate that does something like you want to achieve, but it expects a .
after your lists in the file.