<div dir="ltr">The problem is exactly what the error message says - it is a syntax error. The message says that the syntax error is before the symbol '->'.<div><br></div><div>1) Can you find all the places where you used that symbol in the above example?</div><div>2) Now compare each one of your uses of '->' to examples in the tutorial you're reading.</div><div>3) Are you using it _exactly_ the same as in the tutorial?</div><div>4) What is different?<div><br></div><div>Hint: I see 2 places to check.</div></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 12, 2015 at 11:34 AM, Roelof Wobben <span dir="ltr"><<a href="mailto:r.wobben@home.nl" target="_blank">r.wobben@home.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
Im trying this exercise from the programming erlang book.<br>
<br>
Look up the definitions of erlang:now/0, erlang:date/0, and erlang:time/0. Write a<br>
function called my_time_func(F), which evaluates the fun F and times how<br>
long it takes.<br>
<br>
So I did this :<br>
<br>
-module(my_time).<br>
<br>
-export( [time_spend/1] ).<br>
<br>
time_spend(F) -><br>
Begintime = time:now(),<br>
F(3),<br>
Endtime = time:now(),<br>
Endtime - Begintime.<br>
<br>
<br>
but then when I do this in erl :<br>
<br>
11> my_time:time_spend(fun x -> 2 * X end).<br>
* 1: syntax error before: '->'<br>
11> my_time:time_spend(Double = fun x -> 2 * X end).<br>
* 1: syntax error before: '->'<br>
<br>
how can I make this work ?<br>
<br>
Roelof<br>
<br>
<br>
---<br>
Dit e-mailbericht is gecontroleerd op virussen met Avast antivirussoftware.<br>
<a href="https://www.avast.com/antivirus" rel="noreferrer" target="_blank">https://www.avast.com/antivirus</a><br>
<br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div><br></div>