[erlang-questions] Imported function as argument

Alex Gerdes alex.gerdes@REDACTED
Mon Jan 27 11:24:18 CET 2014


I recently bumped into the following issue. I expected that it was possible to use an imported function as argument in a higher-order function. For example:



-import(lists, [reverse/1, map/2]).

foo(Xss) ->
  map(fun reverse/1, Xss).

However, the compiler complains that reverse/1 is undefined:

1> c(bla).
bla.erl:8: function reverse/1 undefined

Is it mandatory to give the fully qualified function name for an external function when it is used as argument in a higher-order function?

Best regards,


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140127/4998f71f/attachment.htm>

More information about the erlang-questions mailing list