I am trying to solve this question.
type alias FunSet = Int -> Bool
contains : FunSet -> Int -> Bool
contains set elem = set elem
singletonSet : Int -> FunSet
singletonSet elem = \inputElem -> elem == inputElem
union : FunSet -> FunSet -> FunSet
union a b = (\x -> (contains a x) || (contains b x))
My fold function should do the following:
Takes a list of sets and returns a new set, which is build by applying a fold using operation function.
fold: List FunSet -> ( FunSet -> FunSet -> FunSet ) -> FunSet
fold operation sets =
Example:
(fold union [(singletonSet 1), (singletonSet 2), (singletonSet 3)]) 1 == True
It is not clear to me how should I do this. Hope someone can help ^^