title: write a list to a file elixir
body: <p>I'm unable to write a list to a file in elixir. If I try to write the whole list I get an error, if I try to enumerate over the list I get an error. it's a list of integers.</p>
  
  <pre><code>{:ok, file} = File.open "loop_issues.csv", [:write]
  for item &lt;- find_common_items(list_one, list_two) do
    IO.write(file, item &lt;&gt; ",")
  end    
  File.close file
  </code></pre>
  
  <p>Here's an example of the IEX readout from the module, and me playing with it.</p>
  
  <pre><code>commons
   [6579, 9397]
  ** (ArgumentError) argument error
      (autoupgrader_phx) lib/modules/tree_validator.ex:30: anonymous fn/3 in TreeV
  alidator.check_all_users/0
                (elixir) lib/enum.ex:1755: Enum."-reduce/3-lists^foldl/2-0-"/3
      (autoupgrader_phx) lib/modules/tree_validator.ex:29: anonymous fn/3 in TreeV
  alidator.check_all_users/0
                (elixir) lib/enum.ex:1755: Enum."-reduce/3-lists^foldl/2-0-"/3
      (autoupgrader_phx) lib/modules/tree_validator.ex:14: 
  </code></pre>
  
  <p>Here's where I was messing with it to test it:</p>
  
  <pre><code>iex(2)&gt; {:ok, file} = File.open "test_file.txt", [:write]
  {:ok, #PID&lt;0.469.0&gt;}
  
  iex(3)&gt; whatever = [123, 234, 6324]
  [123, 234, 6324]
  
  iex(4)&gt; IO.write(file, whatever)
  ** (ErlangError) erlang error: :no_translation
      (stdlib) :io.put_chars(#PID&lt;0.469.0&gt;, :unicode, [123, 234, 6324])
  </code></pre>
  
  <p>And in a loop instead, I also tried Enum.reduce:</p>
  
  <pre><code>iex(4)&gt; for thing &lt;- whatever, do: IO.write(file, thing)
  ** (ErlangError) erlang error: :terminated
      (stdlib) :io.put_chars(#PID&lt;0.469.0&gt;, :unicode, "123")
  </code></pre>
  
  <p>What am I doing wrong. I also tried binwrite but that gave the same error.</p>