I'm currently learning elixir and i'm trying to print functions and their arity
print = fn ({function , arity}) ->
IO.puts "#{function}/#{arity}"
end
Enum.__info__(:functions) |> Enum.each(print.())
this returns
** (BadArityError) #Function<0.60149952 in file:learn.exs> with arity 1 called with no arguments
learn.exs:5: (file)
(elixir) lib/code.ex:767: Code.require_file/2
Your issue is how you pass
printtoEnum.each. The variableprintis already bound to a function. When you doprint.()you're calling that function with no arguments and passing the result toEnum.each. What you want instead is to pass theprintfunction itself as an argument toEnum.each. So: