>From official docs:<br><div class="example"><pre>ExprF(Expr1,...,ExprN)<br>ExprM:ExprF(Expr1,...,ExprN)</pre></div>
<p>In the first form of function calls,
<span class="code">ExprM:ExprF(Expr1,...,ExprN)</span>, each of <span class="code">ExprM</span> and
<span class="code">ExprF</span> must be an atom or an expression that evaluates to
an atom. </p>(<a href="http://www.erlang.org/doc/reference_manual/expressions.html#id75726">http://www.erlang.org/doc/reference_manual/expressions.html#id75726</a>)<br>Though it is not clear what "evaluates to atom" may mean for a tuple.<br>
<br>Kind regards,<br>Kirill Zaborsky<br><br><div class="gmail_quote">2011/6/27 Andy W. Song <span dir="ltr"><<a href="mailto:wsongcn@gmail.com">wsongcn@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
I guess I found the answer, see following code<div><div>-module(abc).</div><div>-export([joke/0, test_fun/1]).</div><div><br></div><div>test_fun({abc, _, _}) -></div><div> io:format("Great, ~n").</div><div>
<br></div><div>joke() -></div><div> V = {abc, "tst", "filed2"},</div><div> V:test_fun().</div><div><br></div><div>If I call abc:joke() it will eventaully call test_fun/1, with V as the parameter. I would like to see some official documentation though. </div>
<div><br></div><div>Thanks</div><div>Andy</div><br><div class="gmail_quote">On Mon, Jun 27, 2011 at 1:28 PM, Andy W. Song <span dir="ltr"><<a href="mailto:wsongcn@gmail.com" target="_blank">wsongcn@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
In my case the variable is a record like V = {rec, field1, field2} where rec is indeed a module name with fun() defined in it. So it seems that calling to this record will in turn call the first element?<div><br></div><div>
Thanks</div><div>Andy<br><div><div><div></div><div><br><br><div class="gmail_quote">On Mon, Jun 27, 2011 at 12:35 PM, Jack Moffitt <span dir="ltr"><<a href="mailto:jack@metajack.im" target="_blank">jack@metajack.im</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><div></div><div>> New to Erlang. I saw some program with statement such as V:fun() which I<br>
> can't find from Joe's Erlang book. I know module:fun() is calling a function<br>
> defined in a module. But do this to a variable is confusing. Does that<br>
> variable define a function, and how?<br>
<br>
</div></div>It is probably bound to an atom, like in this example:<br>
<br>
X = dict,<br>
D = X:new().<br>
<font color="#888888"><br>
jack.<br>
</font></blockquote></div><br><br clear="all"><br></div></div>-- <br><div>---------------------------------------------------------------</div><div>有志者,事竟成,破釜沉舟,百二秦关终属楚</div><div>苦心人,天不负,卧薪尝胆,三千越甲可吞吴</div><br>
</div></div>
</blockquote></div><br><br clear="all"><br>-- <br><div>---------------------------------------------------------------</div><div>有志者,事竟成,破釜沉舟,百二秦关终属楚</div><div>苦心人,天不负,卧薪尝胆,三千越甲可吞吴</div><br>
</div>
<br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br>