Im trying to evaluate manually fc [f1, f2] (\x -> 2) 3
but I don't realize how to match the three parameters: [f1, f2], (\x -> 2) and 3 with the function definition, any help?
The function definition:
fc xss = \f -> let ope x y = x . f . y in foldr1 ope xss
f1, f2 :: Int -> Bool
f1 x = (x `mod` 3) == 0
f2 x = (x `mod` 5) == 0
Thanks,
Sebastián.
Well, first do some η-expansion
Then perhaps inline the
let
You can write
[f1, f2]
as(==0).(`mod`3) : (==0).(`mod`5) : []
.Now it should be easy enough, remembering that a right-fold simply replaces all
:
with the fold function.