title: Store a list in Erlang ETS
body: <p>I am trying to insert a list into ETS to pull out later and for some reason it is saying it is a bad arg. I'm not sure if I'm inserting it incorrectly.</p>
  
  <p>Is it just not possible to insert a list into ETS?</p>
  
  <p>The offending line is <code>ets:insert(table, [{parsed_file, UUIDs}])</code>.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>readUUID(Id, Props) -&gt;
      fun () -&gt; 
          %%TableBool = proplists:get_value(table_bool, Props, &lt;&lt;""&gt;&gt;),
          [{_, Parsed}] = ets:lookup(table, parsed_bool),
          case Parsed of
            true  -&gt;
              {uuids, UUIDs} = ets:lookup(table, parsed_bool),
              Index = random:uniform(length(UUIDs)),
              list_to_binary(lists:nth(Index, UUIDs));
            false -&gt; 
              [{_, Dir}] = ets:lookup(table, config_dir),
              File = proplists:get_value(uuid_file, Props, &lt;&lt;""&gt;&gt;),
              UUIDs = parse_file(filename:join([Dir, "config", File])),
              ets:insert(table, [{parsed_file, {uuids, UUIDs}}]),
              ets:insert(table, [{parsed_bool, true}]),
              Index = random:uniform(length(UUIDs)),
              list_to_binary(lists:nth(Index, UUIDs))
          end
      end.
  
  parse_file(File) -&gt;
    {ok, Data} = file:read_file(File),
    parse(Data, []).
  
  parse([], Done) -&gt;
    lists:reverse(Done);
  
  parse(Data, Done) -&gt;
    {Line, Rest} = case re:split(Data, "\n", [{return, list}, {parts, 2}]) of
                     [L,R] -&gt; {L,R};
                     [L]   -&gt; {L,[]}
                   end,
    parse(Rest, [Line|Done]).
  </code></pre>