title: call an undefined function in erlang
body: <p>I want to export DATA fom table mnesia to the txt file</p>
  
  <p>I try with this code :</p>
  
  <pre><code>exporttxt()-&gt;
       F = fun(T) -&gt; mensia:foldl(fun(X,Acc) -&gt; [X|Acc] end, [],T) end,
  {atomic,L} = mnesia:transaction(F(user)),
  file:write_file("test.txt",[io_lib:format("~p\t~p\t~p~n",[F1,F2,F3]) || 
                   #user{id = F1,adress = F2,birthday = F3} &lt;- L]).
  </code></pre>
  
  <p>but when I test this function I have this error :</p>
  
  <pre><code>Erlang R13B03 (erts-5.7.4) [source] [rq:1] [async-threads:0] [hipe] [kernel-poll:false]
  
  Eshell V5.7.4  (abort with ^G)
  1&gt; model:exporttxt().
  ** exception error: undefined function mensia:foldl/3
       in function  model:exporttxt/0
  2&gt; 
  </code></pre>
  
  <p>as you see I work with erlang version 13 </p>
  
  <p><strong>I try now with this code :</strong></p>
  
  <pre><code>exporttxt()-&gt;
       F = fun(T) -&gt; mnesia:foldl(fun(X,Acc) -&gt; [X|Acc] end, [],T) end,
  {atomic,L} = mnesia:transaction(F(user)),
  file:write_file("test.txt",[io_lib:format("~p\t~p\t~p~n",[F1,F2,F3]) || 
                   #user{id = F1,adress = F2,birthday = F3} &lt;- L]).
  </code></pre>
  
  <p>but I have this error :</p>
  
  <pre><code>** exception exit: {aborted,no_transaction}
       in function  mnesia:abort/1
       in call from model:exporttxt/0
  </code></pre>
  
  <p>I try also with :</p>
  
  <pre><code> exporttxt()-&gt;
           F = fun(T) -&gt; mnesia:foldl(fun(X,Acc) -&gt; [X|Acc] end, [],T) end,
      {atomic,L} = mnesia:transaction(F),
      file:write_file("test.txt",[io_lib:format("~p\t~p\t~p~n",[F1,F2,F3]) || 
                       #user{id = F1,adress = F2,birthday = F3} &lt;- L]).
  </code></pre>
  
  <p>but I have this error :</p>
  
  <pre><code>** exception error: no match of right hand side value 
                      {aborted,{{badarity,{#Fun&lt;model.208.16694406&gt;,[]}},
                                [{mnesia_tm,apply_fun,3},
                                 {mnesia_tm,execute_transaction,5},
                                 {model,exporttxt,0},
                                 {erl_eval,do_apply,5},
                                 {shell,exprs,6},
                                 {shell,eval_exprs,6},
                                 {shell,eval_loop,3}]}}
       in function  model:exporttxt/0
  </code></pre>