Why special function apply(Mod, Func, Args).

Goran Bage goran.bage@REDACTED
Fri Feb 7 15:49:31 CET 2003


Mickael Remond wrote:

> With the other syntax, you can only use variable name and not function calls:
> 
> 1> Mod=io.
> io
> 2> Function=format.
> format
> 3> Mod:Function("~p~n", ["Hello"]).                                      
> "Hello"
> 

Hmm, it is more general than that

Eshell V5.2  (abort with ^G)
1> F = fun () -> io end.
#Fun<erl_eval.19.280769>
2> F1 = fun () -> format end.
#Fun<erl_eval.19.280769>
3> (F()):(F1())("~p \n", ["hello"]).
"hello"
ok
4>

works for me.

-- 
-- Goran
------------------------- May the Snow be with you ----
  Goran Bage,          MobileArts,     www.mobilearts.se
  Tjärhovsgatan 56,    SE-102 67 Stockholm,       Sweden
  email:goran.bage@REDACTED,  phone: +46 733 358405


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3443 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20030207/24eb3ab2/attachment.bin>


More information about the erlang-questions mailing list