title: reading files in Prolog
body: <p>I am trying to read the file 'nouns.csv' which looks like this in notepad:</p>
  
  <pre><code>femin,femin,1,f,woman,women.
  aqu,aqu,1,f,water,waters.
  </code></pre>
  
  <p>I have tried using this in SWI-Prolog:</p>
  
  <pre><code>18 ?- read(X).
  X = end_of_file.
  
  19 ?- see('nouns.csv').
  true.
  
  20 ?- seeing(X).
  X = &lt;stream&gt;(000000000017F770).
  
  21 ?- read(X).
  X = end_of_file.
  
  22 ?- 
  </code></pre>
  
  <p>I have absolutely no experience with Input and Output (in any language) and I am confused. I thought read(X) would return the whole file as a string (which I thought is a stream). I want to read in each line and apply this predicate to it:</p>
  
  <pre><code>nounstage(Input) --&gt;
      ["noun("],
      [Adjust],
      [")."],
      {
           append(Adjust,[46],Input)
      }.
  
  nounlineparse(X,Y) :-
      phrase(nounstage(X),N),
      flatten(N,Y),
      asserta(Y).
  </code></pre>
  
  <p>I presumed I would make a giant list of every line in the nouns.csv, then iterate through the list and apply nounlineparse to each element. How can I get my file/stream into this giant list (or is the giant list way a bad way of doing this?). </p>