[erlang-questions] apply/2

Henrique Ferreiro henrique.ferreiro@REDACTED
Fri Jul 27 18:54:47 CEST 2007


O Ven, 27-07-2007 ás 18:51 +0200, Jeremy Thurgood escribiu:
> Henrique Ferreiro wrote:
> > Hello,
> > 
> > I noticed some extrange behaviour that this list surely can explain:
> 
> 1> round(2.3).
> 2
> 2> apply(round, [2.3]).
> 
> =ERROR REPORT==== 27-Jul-2007::18:47:02 ===
> Error in process <0.29.0> with exit value: 
> {{badfun,round},[{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]}
> 
> ** exited: {{badfun,round},
>              [{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} **
> 3> apply(erlang, round, [2.3]).
> 2
> 
> Looks like you need to specify the module...

Taken from man erlang:

       apply(Fun, Args) -> term() | empty()

              Types  Fun = fun()
                     Args = [term()]

              Call a fun, passing the elements in Args as arguments.

> I'm not comfortable enough with the docs to find the reason in the time 
> I have available, however. Sorry.  :-/
> 
> --J




More information about the erlang-questions mailing list