Skip to content

Instantly share code, notes, and snippets.

@josePhoenix
Created September 22, 2014 00:47
Show Gist options
  • Select an option

  • Save josePhoenix/23555399ee2d2b355cb7 to your computer and use it in GitHub Desktop.

Select an option

Save josePhoenix/23555399ee2d2b355cb7 to your computer and use it in GitHub Desktop.
iex(6)> mydata = [{"foo", 1}, {"bar", 34}, {"quux", -2}]
[{"foo", 1}, {"bar", 34}, {"quux", -2}]
iex(7)> Enum.map(mydata, IO.inspect)
** (UndefinedFunctionError) undefined function: IO.inspect/0
(elixir) IO.inspect()
iex(7)> myinspect = fn a -> IO.inspect a end
#Function<6.90072148/1 in :erl_eval.expr/5>
iex(8)> Enum.map(mydata, myinspect)
{"foo", 1}
{"bar", 34}
{"quux", -2}
[{"foo", 1}, {"bar", 34}, {"quux", -2}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment