I would like the &(&N)
magic shortcut to somehow be able to be made available for zero arity functions. I don’t care what the syntax is, as long as it’s not too ugly, but I’m tired of starting to write a quick lambda and say to my self FFF— it’s zero arity!!
Cold shivers
The problem is that this function would need to change from
def foo do
|> bar()
end
Into:
def foo(param) do
param
|> bar()
end
Which mean that def
need to be aware of the function body. Additionally it would hide real arity of the function which could cause confusion.
Have you tried &foo/0
? This works for any arity.
2 Likes
I’m talking about a situation where you want to have enclosed values (curried? I think), e.g. &my_function(value_a, value_b)
1 Like
we could solve this in a java-like way:
defp functor_factory(value_a, value_b), do: fn
my_function(value_a, value_b)
end
spawn(functor_factory(value_a, value_b))
Cool idea! This seems like something one could cover with a macro yeah?
I forgot about the function name :), I’m trying to learn colemak layout and I’m focuring too much on the keyboard - I edited my post