With normal fun syntax it is possible to directly call an anonymous function by putting parentheses after it, like this:
fun(N) -> N * 2 end(10)
Similarly, it should be possible to call a partially applied function by putting parentheses after it like this:
lists:all(is_integer(), _)([1, 2, 3])
But at the moment that will not compile, due to an unexpected ( after the "partial function call".
Solution
Compare the AST of a module where the normal anonymous function call with arguments is performed, and generate something that looks the same way with curried functions.
Pitfall
The arguments applied directly to the fun can also be unknown. This should therefore return a function:
lists:all(is_integer(), _)(_)
The example is silly but for consistency with current Erlang syntax, and the functionality of this very project, there is no reason for it not to work.
An explicit anonymous function definition should also support this.
Description
With normal
fun
syntax it is possible to directly call an anonymous function by putting parentheses after it, like this:Similarly, it should be possible to call a partially applied function by putting parentheses after it like this:
But at the moment that will not compile, due to an unexpected
(
after the "partial function call".Solution
Compare the AST of a module where the normal anonymous function call with arguments is performed, and generate something that looks the same way with curried functions.
Pitfall
The example is silly but for consistency with current Erlang syntax, and the functionality of this very project, there is no reason for it not to work.
should therefore be able to return a function.