Reputation: 801
Let say i have a predicate is_foo?/1
in Elixir
I want to use it in a function taking a predicate as an argument, but negated.
Is there a way in Elixir to do that simply ?
Upvotes: 4
Views: 2293
Reputation: 13837
&(!is_foo? &1)
should do it.
Or if you prefer the long form, fn x -> !is_foo? x end
Upvotes: 5