[Haskell-cafe] help with a question
haonan21
heyitsjeremy at gmail.com
Tue Jun 9 20:13:57 EDT 2009
I'm very new to haskell hugs and would appreciate it if someone could help me
out here. I've been giving 2 questions.
1.) A and B are two sets of integers. Implement a function to obtain the
integers that belong to both sets.
Test your function fully.
2.) Define and test a function f, which, if A is a set of {x, y, z} then
f(A) = {{},{x}, {y}, {z}, {x, y}, {x,z}, {y,z}, {x, y, z}}
Manage to get the first one.
interset::[Int]->[Int]->[Int]
interset x [] = []
interset [] y = []
interset x@(xs:xt) y@(ys:yt) =
if xs == ys
then as:(interset at yt)
else interset at y
Totally have no clue for the 2nd question. could someone help me out ?
Many thanks!
--
View this message in context: http://www.nabble.com/help-with-a-question-tp23946402p23946402.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
More information about the Haskell-Cafe
mailing list