Hi,
I've written this function here:
scramble [] = []
scramble [x] = [[z] | z - scramble x]
scramble (x:xs) =
[(y:z)|y - scramble x, z - scramble xs]
and (I think) it roughly does what I want it to:
*Main scramble ([]::[Int])
[]
*Main scramble ([1]::[Int])
[[1],[2]]
2008/10/16 John Ky [EMAIL PROTECTED]:
Hi,
I've written this function here:
scramble [] = []
scramble [x] = [[z] | z - scramble x]
scramble (x:xs) =
[(y:z)|y - scramble x, z - scramble xs]
and (I think) it roughly does what I want it to:
*Main scramble ([]::[Int])
John Ky wrote:
Hi,
I've written this function here:
scramble [] = []
scramble [x] = [[z] | z - scramble x]
scramble (x:xs) =
[(y:z)|y - scramble x, z - scramble xs]
and (I think) it roughly does what I want it to:
That is strange, as it does not even type-check ;-)
See the y
Hi Luke,
Thankyou so much. I need the sequence function.
What I was after was this:
class Scramblable a where
scramble :: a - [a]
instance Scramblable [MyType] where
scramble values = sequence (map scramble values)
instance Scramblable MyType where
scramble myType = {- blah blah -}