title: Prolog I/O reading file and extracting info to use
body: <p>During my journey in Prolog, now I am stuck with i/o part. I was trying to read a file which is written in a specific format and create my facts with them and use these facts. But after reading several libraries and examples in stackoverflow, I could not manage to come up an answer though. For example, this is my file. </p>
  
  <pre><code>a,b,c,d,e
  funct(a,[1,2,3,4,5])
  funct(b,[2,4,6,8,10]
  funct(c,[1,3,5,7,9])
  funct(d,[1,1,2,3,5])
  funct(e,[3,7,11,19,23])
  </code></pre>
  
  <p>funct/2 has list in terms of every element which is written in first line. I tried to get first line at the beginning then use it, but I could not manage to do it. I think it is the right way, although after trying Prolog now I cannot be so sure of myself. What I am trying to do is this:</p>
  
  <pre><code>functExp(a,a,1)
  functExp(a,b,2)
  functExp(a,c,3)
  functExp(a,d,4)
  functExp(a,e,5)
  functExp(a,b,1)
  functExp(b,a,2)
  functExp(b,b,4)
  functExp(b,c,6)...
  </code></pre>
  
  <p>I am using SWI-Prolog btw.</p>
  
  <p>Edit : Sorry for inconvience. I had no idea that trying to use "funct" is wrong. I corrected what I expect. functExp/3 is the output I'm trying to get and its different from funct.I think I should use assert/assertz built-in function but I am still not sure what I should do.Again I'm so sorry for my misunderstanding. I'm still a newbie as you may guess, so I would be appreciated if you an bear with me.</p>