I am reading this book with great enthusiasm.
So far the code works great but while running the examples in Predicates That Span Contexts
section I am encountering some function arity errors as below -
iex(13)> FunPark.Ride.eligible?(alice, tea_cup)
** (FunctionClauseError) no function clause matching in FunPark.Monoid.FunPark.Monoid.PredAll.wrap/2
The following arguments were given to FunPark.Monoid.FunPark.Monoid.PredAll.wrap/2:
# 1
%FunPark.Monoid.PredAll{
value: &FunPark.Monoid.PredAll.default_pred?/1
}
# 2
#Function<1.2796843/2 in FunPark.Ride.tall_enough?>
Attempted function clauses (showing 1 out of 1):
def wrap(%FunPark.Monoid.PredAll{}, value) when is_function(value, 1)
Apparently, we are passing two arguments instead of one here -
def eligible?(%Patron{} = patron, %__MODULE__{} = ride),
do: p_all([&tall_enough?/2, &old_enough?/2]).(patron, ride)
I ran the book’s sample code and it works fine. But it has code with curry.
I am wondering if the example code from this section is supposed to run without curry as I am typing in the code as I go.
Thanks!