when trying to define a function that would remove the largest subset of set m that is also a subset of set a from set a, I encountered the following error:
filename.hs:7:33:parse error (possibly incorrect indentation)
for the following code:
exclude :: Integral t => [t] -> [t] -> [t]
a `exclude` m
| m == [] = a
| a == (b ++ c) = b
| otherwise = []
where b /= []
where c = [z | z <- m]
how do I implement multiple conditions/definitions (using where or otherwise), or correct the function to properly work in a different way?
Saying “the largest subset of set
mthat is also a subset of seta”is the same as saying “all elements of
mthat are also elements ofa“.Then the solution to your problem is stated simply as:
which when applied to
mwill give you a subset ofmmodulo any elementsthat are also members of
a. That is, it will “remove the largest subset ofmthat is also a subset ofa“.