[erlang-questions] Where is the syntax error.
Thu Sep 24 14:51:00 CEST 2015
On Thu, Sep 24, 2015 at 02:45:06PM +0200, Roelof Wobben wrote:
> For a exercise I had to write a function which keeps track how long
> a anymous function takes with the help of time:now.
> So I have this :
> elapsed_time(F) ->
> Begintime = erlang:monotic_time(),
> Endtime = erlang:monotonic_time(),
> Time = erlang:convert_timeunit(Endtime - Begintime,native ,
> Now I want to test it in erl.
> But then I see this output:
> time:elapsed_time(Answer = fun() -> io:format("Sucess") end. ).
> * 1: syntax error before: '.'
> Can someone give me a tip where the syntax errror is.
Well, like the error message says, it's something to do with a dot.
You've got two dots in that line of code. Which one is wrong?
Hint: a dot is the end of an expression to be evaluated (in the shell)
or the end of a function definition (in a module).
Hugo Mills | 2 + 2 = 5, for sufficiently large values of 2.
PGP: E2AB1DE4 |
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 836 bytes
Desc: Digital signature
More information about the erlang-questions