Thanks all!<br><br><div class="gmail_quote">On Wed, Nov 5, 2008 at 10:29 PM, Tamas Nagy <span dir="ltr"><<a href="mailto:lestat@elte.hu">lestat@elte.hu</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi!<br>
<br>
Try it like this:<br>
<br>
(X#test.my_fun)(1).<br>
<br>
Regards,<br><font color="#888888">
Tamas</font><div><div></div><div class="Wj3C7c"><br>
On 5 Nov 2008, at 21:03, Jeroen Koops wrote:<br>
<br>
</div></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="Wj3C7c">
Hello,<br>
<br>
I have a record with a member to which I assign a function:<br>
<br>
$ cat test.hrl<br>
-record(test, { my_fun }).<br>
$<br>
<br>
and, from the Erlang shell:<br>
<br>
18> rr("test.hrl").<br>
[test]<br>
19> X=#test{my_fun = fun(X) -> X*2 end}.<br>
#test{my_fun = #Fun<erl_eval.6.49591080>}<br>
<br>
When I try to invoke the function, the shell complains with a syntax error:<br>
<br>
20> X#test.my_fun(1).<br>
** 1: syntax error before: '(' **<br>
<br>
Of course, it does work when first assigning the record-member to a variable:<br>
<br>
21> Y=X#test.my_fun.<br>
#Fun<erl_eval.6.49591080><br>
22> Y(1).<br>
2<br>
<br>
Is there some syntactical subtlety I'm missing out on, or is this something I should just not want?<br>
<br>
Thanks,<br>
<br>
Jeroen<br>
<br></div></div><div class="Ih2E3d">
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://www.erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://www.erlang.org/mailman/listinfo/erlang-questions</a><br>
</div></blockquote>
<br>
</blockquote></div><br>