title: Unable to use Erlang/ets in receive block
body: <p>I am trying to use Erlang/ets to store/update various informations by pattern matching received data. Here is the code</p>
  
  <pre><code>start() -&gt; 
      S = ets:new(test,[]),
      register(proc,spawn(fun() -&gt; receive_data(S) end)).
  
  receive_data(S) -&gt;
      receive
          {see,A} -&gt; ets:insert(S,{cycle,A}) ;
          [[f,c],Fcd,Fca,_,_] -&gt; ets:insert(S,{flag_c,Fcd,Fca});
          [[b],Bd,Ba,_,_] -&gt; ets:insert(S,{ball,Bd,Ba})
  
  
  
      end,
      receive_data(S).
  </code></pre>
  
  <p>Here A is cycle number, [f,c] is center flag , [b] is ball and Fcd,Fca, Bd, Ba are directions and angle of flag and ball from player. </p>
  
  <p>Sender process is sending these informations. Here, <strong>pattern matching is working correctly</strong> which I checked by printing values of A, Fcd,Fca..etc. I believe there is something wrong with the use of Erlang/ets.</p>
  
  <p>When I run this code I get error like this </p>
  
  <pre><code>Error in process &lt;0.48.0&gt; with exit value: {badarg,[{ets,insert,[16400,{cycle,7}]},{single,receive_data,1}]
  </code></pre>
  
  <p><strong>Can anybody tell me what's wrong with this code and how to correct this problem?</strong></p>