Skip to content

Instantly share code, notes, and snippets.

@bneijt
Created December 6, 2010 13:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bneijt/730285 to your computer and use it in GitHub Desktop.
Save bneijt/730285 to your computer and use it in GitHub Desktop.
lists:map(fun(X) -> erlang:display(X) end, ["hello"]).
lists:map(erlang:display, ["hello"]).
%Wrong, you can not refer to erlang:display that way. Would you be pointing to erlang:display/1 or erlang:display/2 ??
lists:map(erlang:display/1, ["hello"]).
%Illegal expression, erlang:display/1 is more like splitting an atom in 1 then it is referring to a function
lists:map(fun erlang:display/1, ["hello"]).
%Yes, this will work. I'm now referring to the function display/1 in the erlang module... few.
[erlang:display(X) || X <- ["hello"]].
%Also works, list expressions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment