In: Computer Science
In Haskell
Write a function equal that returns whether two sets are equal.
equal :: Set -> Set -> Bool
import Data.List
equal :: (Eq set) => [set] -> [set] -> Bool ---function declaration
equal a b = null (a \\ b) && null (a \\ b) -------function definition
main = do ------main function
putStrLn "check the given sets are equal or not:"
print("[1,2,3,4] and [1,2,3,4] are equal or not ")
print(equal [1,2,3,4] [1,2,3,4]) --- function calling
print("[2,3,4] and [1,2,3,4] are equal or not ")
print(equal [2,3,4] [1,2,3,4]) -----functioncalling
program and sample output