syntax function into Erlang -


i have module written notepad:

-module(hhfuns). -compile(export_all).  one() -> 1. two() -> 2. add(x,y) - x() + y(). 

and save hhfuns.erl. when run ok called:

hhfuns:add(myfun hhfun:one/0, myfun hhfun:two/0). 

this command make syntax error. when changed myfun fun worked.maybe it's basic syntax i'm new @ erlang, please explain me why.

when passing function outside module parameter should use syntax fun module:function/arity. correct version hhfuns:add(fun hhfun:one/0, fun hhfun:two/0). fun here required keyword , can not use myfun here instead.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -