"&" Without parameters

I have it:

    case test123(&(:some_module.test456(789))) do
      # ...
    end

Error:

invalid args for &, expected an expression in the format of &Mod.fun/arity, 
&local/arity or a capture containing at least one argument as &1, 
got: :some_module.test456(789)

However, I don't have a parameter to go into it, and before that it was just

 fn(_) -> :some_module.test456(789) end

How to fix it? Return to "fn"?

+4
source share
1 answer

The syntax &cannot be used to create such anonymous functions, because the compiler cannot know if you want to create 0 or 1 or 2 or more arity functions. You will need to continue to use fn(_) -> :some_module.test456(789) end.

+4
source

Source: https://habr.com/ru/post/1676670/


All Articles