Question: Please implement the following function in Haskell. Refer to the specifications below with included sample run powerset powerset : [Int] -> l[Int] Given a list

Please implement the following function in Haskell. Refer to the specifications below with included sample run

Please implement the following function in Haskell. Refer to the specifications below

powerset powerset : [Int] -> l[Int] Given a list of unique integers, create a list version of the powerset: a list of all possible sublists of unique values. As long as exactly the correct lists are present, the order of those sublists is unimportant. The given sameItems definition (which uses sameNums and subSet) is what the tester uses to check your answer. You may copy it to your own file (just drop the "let", which is only needed below for the interactive session, and not when defining functions in a file *Homework32 let sameNums xs ys = and $ map (\x->x elen ys) xs *Homework32 let subset xss yss = and $ (map (\xs-> or $ map (sameNums xs) yss) xss) *Homework3- let same!tems xss yss = subset xss yss && subset yss xss *Homework3> powerset 1 Homework3> powerset [1,2 Homework3> powerset [,2,3] Homework3> sameItems (powerset 1,2,31) 1.111,12],131.11,2],[1,3],[2,3],11,2,31 True powerset powerset : [Int] -> l[Int] Given a list of unique integers, create a list version of the powerset: a list of all possible sublists of unique values. As long as exactly the correct lists are present, the order of those sublists is unimportant. The given sameItems definition (which uses sameNums and subSet) is what the tester uses to check your answer. You may copy it to your own file (just drop the "let", which is only needed below for the interactive session, and not when defining functions in a file *Homework32 let sameNums xs ys = and $ map (\x->x elen ys) xs *Homework32 let subset xss yss = and $ (map (\xs-> or $ map (sameNums xs) yss) xss) *Homework3- let same!tems xss yss = subset xss yss && subset yss xss *Homework3> powerset 1 Homework3> powerset [1,2 Homework3> powerset [,2,3] Homework3> sameItems (powerset 1,2,31) 1.111,12],131.11,2],[1,3],[2,3],11,2,31 True

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!