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
Post a Comment