Your use of mutliplesOfKLessThanN
is not correct
mutliplesOfKLessThanN((3,5) 1000)
Is not interpreted by Haskell as
Apply
mutliplesOfKLessThanN
with(3,5)
and1000
.
but instead it is interpteted as
Apply
(3,5)
to1000
and applymultiplesOfKLessThanN
to the result.
I think your misconception is in how function application occurs. In many languages function application requires parentheses e.g. f(x)
. For Haskell parentheses, only ever mean do this operation first, and function application is achieved by putting things next to each other. So f(x)
works in Haskell because it is the same as f x
, but f(x y)
is the same as f(x(y))
and tells Haskell to evaluate x y
first and then give it to f
.
With your code Haskell can’t apply (3,5)
as a function, which is what Haskell is telling you, it expected a function (in fact a specific type of function).
The proper way to write this would be
multiplesOfKLessThanN (3,5) 1000
This should handle that main error you are getting.